BrandonBarker Posted September 16, 2013 Share Posted September 16, 2013 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 I dont want to have to change each page header and footer for every change i make. Thank you in advance people Link to comment https://forums.phpfreaks.com/topic/282205-new-to-php-help-setting-up-headertpl-and-footertpl/ Share on other sites More sharing options...
davidannis Posted September 16, 2013 Share Posted September 16, 2013 <?php include '/pathtoheader/header.tpl';?> Your page content here <?php include '/pathtofooter/footer.tpl';?> Link to comment https://forums.phpfreaks.com/topic/282205-new-to-php-help-setting-up-headertpl-and-footertpl/#findComment-1449767 Share on other sites More sharing options...
DavidAM Posted September 16, 2013 Share Posted September 16, 2013 <?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'; Link to comment https://forums.phpfreaks.com/topic/282205-new-to-php-help-setting-up-headertpl-and-footertpl/#findComment-1449776 Share on other sites More sharing options...
davidannis Posted September 16, 2013 Share Posted September 16, 2013 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. Link to comment https://forums.phpfreaks.com/topic/282205-new-to-php-help-setting-up-headertpl-and-footertpl/#findComment-1449784 Share on other sites More sharing options...
priyankagound Posted September 17, 2013 Share Posted September 17, 2013 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'; ?> Link to comment https://forums.phpfreaks.com/topic/282205-new-to-php-help-setting-up-headertpl-and-footertpl/#findComment-1449815 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.