Jump to content

New to PhP, Help setting up Header.tpl and Footer.tpl


BrandonBarker

Recommended Posts

Hello Freaks! im looking to set up a header.tpl and a footer.tpl on a new website i want to make, i was wondering if there was a template anywhere that has these? or what files to edit and put the tpl locations in? i need help :P I dont want to have to change each page header and footer for every change i make.

Thank you in advance people 

  On 9/16/2013 at 8:17 PM, davidannis said:

 

<?php include '/pathtoheader/header.tpl';?>
Your page content here
<?php include '/pathtofooter/footer.tpl';?>

 

I would add one step before that. (As long as you are learning, learn the "best practices"):

 

 
<?php
/* All page processing including:
    * Retrieve page parameters
    * Validate user supplied data
    * Retrieve data from database
    * Process data ...
*/
include '/pathtoheader/header.tpl';

/* Your page content here
  (HTML with a sprinkling of PHP to echo data) */

include '/pathtofooter/footer.tpl';
  On 9/16/2013 at 10:10 PM, DavidAM said:

I would add one step before that. (As long as you are learning, learn the "best practices"):

 

 
<?php
/* All page processing including:
    * Retrieve page parameters
    * Validate user supplied data
    * Retrieve data from database
    * Process data ...
*/
include '/pathtoheader/header.tpl';

/* Your page content here
  (HTML with a sprinkling of PHP to echo data) */

include '/pathtofooter/footer.tpl';

DavidAM is right and don't forget session_start(); if you are using sessions.

Personally, I’ve never heard of tpl files before.

What I would do is setup header.php, footer.php and whatever else will be displayed on every page.

Then, just include them by doing this:

<?php include 'header.php'; ?>

<!-- Unique content here -->

<?php include 'footer.php'; ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.