October 21, 200916 yr Hi all This is my current, super-simple website. Sadly, I'm not famous and don't have somebody to do it for me, so I do it myself http://www.stevemccormick.co.uk/ Here is a test page for what I've been working on, using CSS (borrowed from tutorials and edited) for a header/footer. http://www.stevemccormick.co.uk/indextest.html What I want is to be able to keep the header and footer on all pages and load the content somehow, not with frames, hopefully something where every page is searchable/findable via engines. Can anybody advise? I'd also quite like to be able to do little ad boxes where I can update an external file and update all references within the site. Thanks in advance! Steve
October 25, 200916 yr you need to do some includes. this will depend on whether your server is linux or a windows server. Whatever the type of server, the process is the same. You need to create separate files for each element.... header, footer, sidebar etc and then when you create a page, you just include those pages when you are generating your content. The first thing you need to do is create a file called header.php. In this file you will hold all of your page design that comes before your content. Here is an example: <html> <head><title>My Site</title></head> <body> <h2>My Site Title</h2><p> My Site menu goes here........... Choice 1 | Choice 2 | Choice 3 <hr> Next we need to make a file called footer.php. This file will contain all of the site design information that goes below the content. Here is an example: <hr> <small>Copyright 2008 My Site</small><br> </body> </html> Finally you need to create the content pages for your site. In this file you will: Call the header file Put in the page specific content Call the footer file Here is an example of how: <?php include 'header.php'; ?> <b>Sub-Page Title</b><p> Here is the specific content of this page....<br> <?php include 'footer.php'; ?> Tips: Remember to save all your files with the .php extension. You can have more than a header and a footer, if needed create other files to include in the middle and call them the same way! Couple this with the use of a style sheet to change style within the page exclusive content easily as well. Edited January 27, 201016 yr by Sam G added [code] tags
October 25, 200916 yr Do you mean you want to load the content without page refreshes (ajax)? Or create a global header and footer (like above using includes).
Create an account or sign in to comment