devilsvein Posted January 1, 2013 Share Posted January 1, 2013 How would I create a php template that has a banner going across the top, menubar on the left, actual page content on the right and footer at the bottom. I prefer not to keep rewritting the same code over and over.....hence create a template Link to comment https://forums.phpfreaks.com/topic/272590-how-to-create-a-php-template-for-every-page/ Share on other sites More sharing options...
trq Posted January 1, 2013 Share Posted January 1, 2013 Seems simple enough, where exactly are you stuck? Link to comment https://forums.phpfreaks.com/topic/272590-how-to-create-a-php-template-for-every-page/#findComment-1402624 Share on other sites More sharing options...
Jessica Posted January 1, 2013 Share Posted January 1, 2013 Either use a template engine like Smarty or just use includes. Link to comment https://forums.phpfreaks.com/topic/272590-how-to-create-a-php-template-for-every-page/#findComment-1402627 Share on other sites More sharing options...
devilsvein Posted January 1, 2013 Author Share Posted January 1, 2013 so how does include know where to position the code... would it need to be in a function and i call the function on the page. Link to comment https://forums.phpfreaks.com/topic/272590-how-to-create-a-php-template-for-every-page/#findComment-1402634 Share on other sites More sharing options...
trq Posted January 1, 2013 Share Posted January 1, 2013 include includes the included code where you put the call to include. Link to comment https://forums.phpfreaks.com/topic/272590-how-to-create-a-php-template-for-every-page/#findComment-1402641 Share on other sites More sharing options...
devilsvein Posted January 1, 2013 Author Share Posted January 1, 2013 sorry could you elaborate on that. I don't quite fully understand Link to comment https://forums.phpfreaks.com/topic/272590-how-to-create-a-php-template-for-every-page/#findComment-1402650 Share on other sites More sharing options...
trq Posted January 1, 2013 Share Posted January 1, 2013 When you include a file, it is included right where the call to include is placed. Link to comment https://forums.phpfreaks.com/topic/272590-how-to-create-a-php-template-for-every-page/#findComment-1402653 Share on other sites More sharing options...
devilsvein Posted January 1, 2013 Author Share Posted January 1, 2013 ah so i could have like, as a example //some code here then .. echo "<div align=left>"; include "menu"; echo "</div> <div align=right>"; include "page"; echo "</div"> Link to comment https://forums.phpfreaks.com/topic/272590-how-to-create-a-php-template-for-every-page/#findComment-1402655 Share on other sites More sharing options...
wright67uk Posted January 1, 2013 Share Posted January 1, 2013 Create your banner that you would like to use and save it as a separate file. eg. banner.php You can then include the whole file. eg. <?php include 'banner.php'; ?> Link to comment https://forums.phpfreaks.com/topic/272590-how-to-create-a-php-template-for-every-page/#findComment-1402657 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.