Jump to content

Displaying HEader / Footer tpl on non phpvms pages


nexiss28

Recommended Posts

Hi all

Ok I have phpvms installed and skinned and all running sweet as, I still have alot to do but the core is there and working.

Now my question is I have some pre build php pages built from my last site, how do I get them to use the PHPVMS header and foodter tpl pages so the navigation is sycronised sitewide? what code would I have to add to these pages? or is it just a case of puting a page in its own modual folder and calling it from the navigation by setting up a manual link in core navigation?

please bare in mind I'm no php coder when you give me an answer I can work it out after many hours of sairting blankley at it but no way can I write it.

many thanks

Link to comment
Share on other sites

  • Administrators

Hey,

This should be simple to do, in your PHP page you can do this.

This goes at the top of your PHP page (be sure to change the first line to the proper path)

<?php
include '/path/to/core/codon.config.php';
$BaseTemplate = new TemplateSet;

# Load the main skin
$settings_file = SKINS_PATH.DIRECTORY_SEPARATOR.CURRENT_SKIN . '.php';
if(file_exists($settings_file))
   include $settings_file;

$BaseTemplate->template_path = SKINS_PATH;

$BaseTemplate->Set('title', SITE_NAME);

Template::Set('MODULE_NAV_INC', $NAVBAR);
Template::Set('MODULE_HEAD_INC', $HTMLHead);

$BaseTemplate->ShowTemplate('header.tpl');

flush();
?>

Then where the footer goes:

<?php
$BaseTemplate->ShowTemplate('footer.tpl');
# Force connection close
DB::close();
?>

And you should be set

Link to comment
Share on other sites

Hi Brilliant it works a treat except, when I am logged in and then go to one of my php pages using the script you supplied it shows the not logged in menu but then if I go to a phpvms page it shows the correct menu, how do I tell the system which pages are public and which are members only.

other than that it works great, thanks

Link to comment
Share on other sites

Only to skin it the code is below:

<?php

/**

*

* STOP!!!!!!!!

*

*

*

*

* Are you editing the crystal skin directly?

* DON'T

*

* Copy and rename the crystal folder. Otherwise it'll get

* overwritten in an update.

*

* Also, READ THE DOCS

*

http://www.phpvms.net/docs/skinning

*

*/

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title><?php echo $title; ?></title>

<link rel="stylesheet" media="all" type="text/css" href="<?php echo SITE_URL?>/lib/skins/nexiss/styles.css" />

<?php

Template::Show('core_htmlhead.tpl');

?>

<style type="text/css">

<!--

body {

background-color: #CEFFCF;

margin-top: 20px;

}

-->

</style></head>

<body>

<p>

  <?php

Template::Show('core_htmlreq.tpl');

?>

</p>

<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td width="229"><img src="/lib/images/Head Top Left.jpg" width="241" height="111" /></td>

    <td width="303"><img src="/lib/images/Head Top Center.jpg" width="334" height="111" /></td>

    <td width="268"><img src="/lib/images/Head Top Right.jpg" width="539" height="111" /></td>

  </tr>

  <tr>

    <td><img src="/lib/images/Head Middle Left.jpg" width="241" height="73" /></td>

    <td><img src="/lib/images/Head Middle Center.jpg" width="334" height="73" /></td>

    <td><img src="/lib/images/Head Right Middle.jpg" width="539" height="73" /></td>

  </tr>

  <tr>

    <td valign="top"><img src="/lib/images/Head Lower Middle Left.jpg" width="241" height="29" /></td>

    <td><img src="/lib/images/Head Lower Middle Center.jpg" width="334" height="29" /></td>

    <td><img src="/lib/images/Head Right Lower Middle.jpg" width="539" height="29" /></td>

  </tr>

  <tr>

    <td colspan="3" bgcolor="#060000"><div id="topNav">

      <ul class="nav">

        <p>

          <?php

Template::Show('core_navigation.tpl');

?>

        </p>

      </ul>

    </div></td>

  </tr>

  <tr>

    <td valign="top"><img src="/lib/images/Head Bottom Left.jpg" width="241" height="12" /></td>

    <td><img src="/lib/images/Head Bottom Center.jpg" width="334" height="12" /></td>

    <td><img src="/lib/images/Head Right Bottom.jpg" width="539" height="12" /></td>

  </tr>

</table>

<p> </p>

and then my page code:

<?php

include 'core/codon.config.php';

$BaseTemplate = new TemplateSet;

# Load the main skin

$settings_file = SKINS_PATH.DIRECTORY_SEPARATOR.CURRENT_SKIN . '.php';

if(file_exists($settings_file))

  include $settings_file;

$BaseTemplate->template_path = SKINS_PATH;

$BaseTemplate->Set('title', SITE_NAME);

Template::Set('MODULE_NAV_INC', $NAVBAR);

Template::Set('MODULE_HEAD_INC', $HTMLHead);

$BaseTemplate->ShowTemplate('header.tpl');

flush();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Nexiss Air Rules</title>

<style type="text/css">

<!--

.style7 {

font-family: Arial;

font-size: 12px;

}

-->

</style>

<style type="text/css">

<!--

body {

background-color: #CEFFCF;

}

.style11 {font-size: 12px; font-weight: bold; font-family: Arial;}

-->

</style>

</head>

<body>

<table width="1114" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#6CC171">

  <tr>

    <td bgcolor="#6CC171" class="style11">General</td>

  </tr>

  <tr>

    <td bgcolor="#E4F3E6"><span class="style7">Every pilot of Nexiss Air must respect all the rules which  are noted here.              The Nexiss Air VA has the right to make minor changes to these  rules without notice, major changes must be notified to the current pilots.The Nexiss Air VA has the right to implement these minor changes  at any time they choose. (f.e. when a staff member notices something due to an  abnormal PIREP)</span></td>

  </tr>

  <tr>

    <td bgcolor="#6CC171" class="style11">1. Pilot Requirments</td>

  </tr>

  <tr>

    <td valign="top" bgcolor="#E4F3E6"><p class="style7">1. The pilot must have any Flight Simulator.</p>

        <p class="style7">2. The pilot must use his/her real identity to join the Virtual Airline.</p>

      <p class="style7">3. The pilot must be able to show professionalism and realism..</p>

      <p class="style7">4. The pilot must respect all other members and the staff.</p>

      <p class="style7">5. The pilot is required to read the rules again every month, this is to  ensure he/she is aware of all minor changes that appear in the rules.</p></td>

  </tr>

  <tr>

    <td bgcolor="#6CC171" class="style11">2. Transfer of Hours</td>

  </tr>

  <tr>

    <td bgcolor="#E4F3E6"><p class="style7">1. When a pilot joins, he/she is allowed to take the hours from a previous  Virtual Airline with him. This is ONLY valid upon registration.</p>

        <p class="style7">2. We don't allow transfer of hours from IVAO or VATSIM.</p></td>

  </tr>

  <tr>

    <td bgcolor="#6CC171" class="style11">3. Inactivity</td>

  </tr>

  <tr>

    <td bgcolor="#E4F3E6"><p class="style7">1. A pilot must fly at least once every 3 months, otherwise the pilot will be <strong>removed without notice</strong>.</p>

        <p class="style7">2. When a pilot is removed, he/she will get a ban of 3 months, after that ban  he/she will be able to join again.</p>

      <p class="style7">3. Exceptions to the "ban rule" (§3.2) can be made, when the pilot meets the  following conditions: he/she must have a good motivation and be an active pilot  before he/she went inactive.</p>

      <p class="style7">4. When an exception is made, the pilot will be required to contact us  personally and will have to complete his/hers first flight in the first month  after he/she rejoined.</p></td>

  </tr>

  <tr>

    <td bgcolor="#6CC171" class="style11">4. Flights</td>

  </tr>

  <tr>

    <td bgcolor="#B3DDB8" class="style11">4.1 General</td>

  </tr>

  <tr>

    <td bgcolor="#E4F3E6"><p class="style7">1. For each flight, the pilot is required to send in <strong>ONE</strong> PIREP - no  more than one PIREP for a flight is allowed - either with FSAcars or the  website (see also §6).</p>

        <p class="style7">2. If <span lang="EN-GB" xml:lang="EN-GB">a pirep has been locke</span>d<span lang="EN-GB" xml:lang="EN-GB">, the  pirep must be send to flightops within 5 days. In</span> <span lang="EN-GB" xml:lang="EN-GB">case  the pirep</span> has <span lang="EN-GB" xml:lang="EN-GB">not been send the pirep will be  cancelled.</span></p>

      <p class="style7">3. TheNexiss Air VA has the right to ask more information about  a PIREP if it thinks something is wrong or just as a routine check.</p>

      <p class="style7">4. A Pilot is not allowed to send a PIREP for a flight that he/she did not  fly.</p>

      <p class="style7">5. A flight may only be PIREPed once correctly.</p>

      <p class="style7">6. Events can only be logged if the pilot participated to the event  itself.</p>

      <p class="style7">7. The pilot is not required to fly the flights at the time indicated in our  timetable, but is encouraged to set his FS Clock to this time.</p></td>

  </tr>

  <tr>

    <td bgcolor="#B3DDB8" class="style11">4.2 Online / Offline</td>

  </tr>

  <tr>

    <td bgcolor="#E4F3E6"><p class="style7">1. All flights, can be flown online or offline.</p>

        <p class="style7">2. Events should be flown online, except when specified otherwise.</p></td>

  </tr>

  <tr>

    <td bgcolor="#B3DDB8" class="style11">4.3 Aircraft</td>

  </tr>

  <tr>

    <td bgcolor="#E4F3E6"><p class="style7">1. The pilot is required to use an aircraft - preferable the timetable one -  according to his rank.</p>

      <p class="style7">2. When no aircraft of the timetable type is available, the pilot should  choose an aircraft according to his rank. The type and livery of that aircraft  can freely be choosen, as long as the performance is more or less the same.  Though the type can never be an aircraft with abnormal jetliner performance  (f.e. an aircraft that doesn't exist at this time i.e. 787).</p>

    <p class="style7">3. The pilot is free too choose the aircraft <strong>for Special Flights, World  Tour and Events</strong> except when specified otherwise.</p></td>

  </tr>

  <tr>

    <td bgcolor="#B3DDB8" class="style11">4.4 Simulation Rate</td>

  </tr>

  <tr>

    <td bgcolor="#E4F3E6"><p class="style7">1. The maximum simulation rate is 1x.</p>

        <p class="style7">2. Flights flown with a simulation rate higher than allowed will be  cancelled.</p></td>

  </tr>

</table>

<p> </p>

<?php

$BaseTemplate->ShowTemplate('footer.tpl');

# Force connection close

DB::close();

?>

</body>

</html>

You can see my site at www.nexissair.co.uk, still in the process of building it at the moment

Thanks Karl

Link to comment
Share on other sites

  • Administrators

Hey,

In your page, you don't need to re-add the header and all that, because it's already done. So this portion:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Nexiss Air Rules</title>


<style type="text/css">
<!--
.style7 {
   font-family: Arial;
   font-size: 12px;
}
-->
</style>

<style type="text/css">
<!--
body {
   background-color: #CEFFCF;
}
.style11 {font-size: 12px; font-weight: bold; font-family: Arial;}
-->
</style>
</head>

<body>

And the corresponding footer, remove all that

Link to comment
Share on other sites

Thanks Nabeel

I have ajusted the page as you suggested above, told you I was no coder, its a wonder I got this far lol, any way I still have the logged out menu on this page regardless of weather I'm logged in or not problem, but when I go back to a phpvms page the right menu appears depending on if logged in or out correctly

Thanks Karl

Link to comment
Share on other sites

  • Administrators

An odd one, make sure there's no whitespace on top of the page inbetween the top and the <?php tag, that could be causing a problem with output buffering.

Otherwise I will investigate further, this is an odd problem

Link to comment
Share on other sites

If it helps here is the code from my core_navigation Page:

<li><a href="<?php echo SITE_URL ?>/index.php/Frontpage">Home</a></li>

<li><a href="<?php echo SITE_URL ?>/index.php/contact">Contact Us</a></li>

<?php

if(!Auth::LoggedIn())

{

// Show these if they haven't logged in yet

?>

<li><a href="<?php echo SITE_URL ?>/index.php/login/">Login</a></li>

<li><a href="<?php echo SITE_URL ?>/index.php/registration">Register</a></li>

   

<?php

}

else

{

// Show these items only if they are logged in

?>

<li><a href="<?php echo SITE_URL ?>/index.php/profile">Pilot Center</a></li>

<?php

}

?>

<li><a href="<?php echo SITE_URL ?>/index.php/pilots">Pilots</a></li>

<li><a href="<?php echo SITE_URL ?>/index.php/acars">Live Map</a></li>

<li><a href="http://nexissair.co.uk/rules.php">Rules</a></li>

<?php echo $MODULE_NAV_INC;?>

<?php

if(Auth::LoggedIn())

{

if(Auth::UserInGroup('Administrators'))

{

echo '<li><a href="'.SITE_URL.'/admin/">Admin Center</a></li>';

}

?>

<li><a href="<?php echo SITE_URL ?>/index.php/login/logout">Log Out</a></li>

<?php

}

?>

Many Thanks

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...