thosecars82 Posted April 11, 2008 Share Posted April 11, 2008 hello folks Could please anybody tell me what the best approach is to build a website which has 5 html pages all of them with the same header and footer and only with static content? Two ideas came to my mind but i don't know which one is the best to make the code more professional in this case: First approach: develop 5 html files Second approach: develop one php file in which there is a header and a footer. And then make the content between the header and footer dynamic with php in order to have the 5 html pages just in one php page. I look forward to seeing your replies. Thanks. Link to comment https://forums.phpfreaks.com/topic/100612-several-html-pages-with-the-same-header-and-footer/ Share on other sites More sharing options...
vbnullchar Posted April 11, 2008 Share Posted April 11, 2008 divide the page to 3 then just include it <?php //index.php content include('header.php'); include('content.php'); include('footer.php'); ?> Link to comment https://forums.phpfreaks.com/topic/100612-several-html-pages-with-the-same-header-and-footer/#findComment-514568 Share on other sites More sharing options...
conker87 Posted April 11, 2008 Share Posted April 11, 2008 You could also do it like: <?php include("header.php"); // of course, you could just add the code from header into this page include($_GET['page'] . ".php"); // index.php?page=hello, etc include("footer.php"); // ditto ?> You'll have to make it slightly more secure, but this is the general idea. Link to comment https://forums.phpfreaks.com/topic/100612-several-html-pages-with-the-same-header-and-footer/#findComment-514593 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.