abhinavsingh89 Posted December 16, 2009 Share Posted December 16, 2009 I have a website which comprises of 35-40 pages. Now the problem with it is that if i have to modify a header or sidebar or footer in one page , than i have to change it in all the pages (as they are common in all the pages) i.e. 35-40 modification are required. What i want to do is centrally control the basic layout from a single file. Now i have no clue how to that as i am new to php. Can anybody help me regarding this?? thanks in advance ABhinav Link to comment https://forums.phpfreaks.com/topic/185334-inserting-page-defaults/ Share on other sites More sharing options...
trq Posted December 16, 2009 Share Posted December 16, 2009 include. Link to comment https://forums.phpfreaks.com/topic/185334-inserting-page-defaults/#findComment-978379 Share on other sites More sharing options...
cags Posted December 16, 2009 Share Posted December 16, 2009 Have header.php and footer.php pages. Inside the header include the document declaration, <head> section, the opening <body> tag and any section at the top of the page that is on every page (header image, top menu, etc.). Footer will include the footer (well duh) and the closing of the </body> and </html> tags. In the header section for any meta tags/title you will simply put something along the lines of <title><?php echo $title; ?></title>. Then in each page you will do... <?php $title = 'Title for this page'; $description = 'Blah, we rock... blah'; $keywords = 'PHP, Freaks, Rock'; require 'header.php'; ?> <!-- Page content here --> <?php require 'footer.php'; ?> Link to comment https://forums.phpfreaks.com/topic/185334-inserting-page-defaults/#findComment-978386 Share on other sites More sharing options...
abhinavsingh89 Posted December 16, 2009 Author Share Posted December 16, 2009 thnx a lot guys.. problem solved. Link to comment https://forums.phpfreaks.com/topic/185334-inserting-page-defaults/#findComment-978429 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.