Jump to content

Making a page with separate template


Recommended Posts

Hello everybody,

I've noticed that a lot of VA's direct you to a management page, separate from the main site, when you log in. This page usually has a completely different template. I have the content all ready - I'm just not quite sure how to make a new page (just one page) with a separate template, but still be able to access the database in the very same way that I do on every other page (because I'm copying some code over).

Thanks so much for the help in advance!

Link to comment
Share on other sites

I have no php knowledge whatsoever...would I put that code in the php code on the page I'm trying to add?

I haven't actually tried this myself, however, my guess would be: include the call for the phpVMS config at the beginning of either the index page, or each seperate page, where you wish to load phpVMS functions. I believe you will then be able to call phpVMS functions as usual.

.. Again, haven't tried this myself.

Link to comment
Share on other sites

Thanks, I've done that...the page is completely blank, just a white page.

When you include the php file, be sure it is within the <body> tag, and not in the <head></head>.

Edit after Tom's Comment: Also be sure to have it before any other content in the <body></body> tag.

Edited by magicflyer
Link to comment
Share on other sites

When you include the php file, be sure it is within the <body> tag, and not in the <head></head>.

To clarify, when including the codon config mentioned above it should be before any HTML output. Anything you want to appear on the page should be within the body tags.

  • Like 1
Link to comment
Share on other sites

I don't think my point was well explained/understood. Here's a valid example starting point:

<?php
 // To avoid errors, this should go before *any* HTML output
 require('/path/to/codon.config.php'); // Call the phpVMS config file
?>
<!doctype html>
<html>
 <head>
   <title>Untitled Document</title>
   <!-- Insert any Style Sheets -->
 </head>
 <body>
   <!-- Page Content -->
 </body>
</html>

It would be easiest for us to help if you could post the source you're using.

Link to comment
Share on other sites

I used that template. Unfortunately, there's still a blank page - even when commenting the php. So I now know that it's not a PHP error, nor is it a problem with the template. Here's my source using your template (and with the php commented):

<?php
 // To avoid errors, this should go before *any* HTML output
 require('/path/to/codon.config.php'); // Call the phpVMS config file
?>
<!doctype html>
<html>
 <head>
    <title>Untitled Document</title>
    <!-- Insert any Style Sheets -->
 <!-- JS BELOW -->
<script>
$(function() {
   var items = $('#v-nav>ul>li').each(function() {
    $(this).click(function() {
	    //remove previous class and add it to clicked tab
	    items.removeClass('current');
	    $(this).addClass('current');
	    //hide all content divs and show current one
	    $('#v-nav>div.tab-content').hide().eq(items.index($(this))).show('fast');
	    window.location.hash = $(this).attr('tab');
    });
   });
   if (location.hash) {
    showTab(location.hash);
   }
   else {
    showTab("tab1");
   }
   function showTab(tab) {
    $("#v-nav ul li:[tab*=" + tab + "]").click();
   }
   // Bind the event hashchange, using jquery-hashchange-plugin
   $(window).hashchange(function() {
    showTab(location.hash.replace("#", ""));
   })
   // Trigger the event hashchange on page load, using jquery-hashchange-plugin
   $(window).hashchange();
});
</script>
<!-- JS ABOVE -->

</head>
<body>
<!--<?php
require('codon.config.php directory'); // Call the phpVMS config file
?>-->
<section id="wrapper" class="wrapper">
   <div id="v-nav">
 <ul>
   <li tab="tab1" class="first current"><a href="#">Dashboard</a></li>
   <li tab="tab2"><a href="#">Statistics & Awards</a></li>
   <li tab="tab3"><a href="#">Support</a></li>
</ul>
<div class="tab-content">
  <h4>News & Notifications</h4>
  <i>No recent news. For all updates, check our <a href="https://plus.google.com/100776819388226273202/posts">Google+</a> page.
  </i>
  <br><br>
  <h4>Live Flights</h4>
  <!--<?php Template::Show('acarsmap.tpl'); ?>-->
  <br><br>
</div>
<div class="tab-content">
  <h4>My Statistics</h4>
  <ul style="margin-top: 0px;">
  <li><strong>Your Pilot ID: </strong> <?php echo $pilotcode; ?></li>
  <li><strong>Your Rank: </strong><?php echo $pilot->rank;?></li>
  <!--<?php
  if($report) { ?>-->
   <li><strong>Latest Flight: </strong><a
  href="<?php echo url('pireps/view/'.$report->pirepid); ?>">
  <?php echo $report->code . $report->flightnum; ?></a>
   </li>
  <!--<?php
  }
  ?>-->

  <li><strong>Total Flights: </strong><?php echo $pilot->totalflights?></li>
  <li><strong>Total Hours: </strong><?php echo $pilot->totalhours; ?></li>
  <li><strong>Total Transfer Hours: </strong><?php echo $pilot->transferhours?></li>
  <li><strong>Total Money: </strong><?php echo FinanceData::formatMoney((floatval($pilot->totalpay) + floatval($pilot->payadjust))) ?></li>

  <!--<?php
  if($nextrank)
  {
  ?>-->
   <br><p>You have to fly <?php echo ($nextrank->minhours - $pilot_hours)?> more
 hours until you promote to <?php echo $nextrank->rank?></p>
  <!--<?php
  }
  ?>-->
 </ul>
 <br><br>
 <h4>Airline Statistics</h4>
 Total Pilots: <?php echo StatsData::PilotCount(); ?><br />Pilots Pending: <?php echo count(PilotData::GetPendingPilots())?><br />Total Hours: <?php echo StatsData::TotalHours(); ?><br />Total Flights: <?php echo StatsData::TotalFlights(); ?><br />Total Distance Flown: <?php echo StatsData::TotalMilesFlown(); ?><br />Total Schedules: <?php echo StatsData::TotalSchedules (); ?><br />Total News Items: <?php echo StatsData::TotalNewsItems (); ?><br />Total Passengers Carried: <?php echo StatsData::TotalPaxCarried (); ?><br />Total Aircraft In Fleet: <?php echo StatsData::TotalAircraftInFleet () ; ?>
 <br><br>
 <h4>My Awards</h4>
 <!--<?php
  if(!$allawards) {
   echo 'No awards yet';
  } else {

   /* To show the image:
 <img src="<?php echo $award->image?>" alt="<?php echo $award->descrip?>" />
   */

  ?>-->
  <ul>
   <!--<?php foreach($allawards as $award){ ?>-->
   <!--<li><?php echo $award->name ?></li>-->
   <!--<?php } ?>-->


  </ul>
  <!--<?php
  }
  ?>-->

</div>
<div class="tab-content">
   <h4>Support</h4>
<form method="post" action="<?php echo url('/contact'); ?>">
 <table width='100%' border='0'>
   <tr>
  <td><strong>Name:</strong></td>
  <td>
 <!--<?php
 if(Auth::LoggedIn())
 {
  echo Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname;
  echo '<input type="hidden" name="name"
 value="'.Auth::$userinfo->firstname
   .' '.Auth::$userinfo->lastname.'" />';
 }
 else
 {
 ?>-->
  <input type="text" name="name" value="" />
  <!--<?php
 }
 ?>-->
  </td>
   </tr>
   <tr>
 <td width="1%" nowrap><strong>E-Mail Address:</strong></td>
 <td>
 <!--<?php
 if(Auth::LoggedIn())
 {
  echo Auth::$userinfo->email;
  echo '<input type="hidden" name="name"
 value="'.Auth::$userinfo->email.'" />';
 }
 else
 {
 ?>-->
  <input type="text" name="email" value="" />
  <!--<?php
 }
 ?>-->
 </td>
</tr>
<tr>
 <td><strong>Subject: </strong></td>
 <td><input type="text" name="subject" value="<?php echo $_POST['subject'];?>" placeholder="Summarize your message with this line"/></td>

</tr>
   <tr>
  <td><strong>Message:</strong></td>
  <td>
 <textarea name="message" cols='60' rows='10'><?php echo $_POST['message'];?></textarea>
  </td>
   </tr>

   <tr>
 <td width="1%" nowrap><strong>Captcha</strong></td>
 <td>
 <!--<?php
 echo recaptcha_get_html(Config::Get('RECAPTCHA_PUBLIC_KEY'), $captcha_error);
 ?>-->
 </td>
</tr>

   <tr>
 <td>
  <input type="hidden" name="loggedin" value="<?php echo (Auth::LoggedIn())?'true':'false'?>" />
 </td>
 <td>
	  <input type="submit" name="submit" value='Send Message'>
 </td>
   </tr>
 </table>
</form>
</div>
</div>
</section>
</body>
</html>


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...