Saturday 24 September 2011

How do you make multipage websites?

I have made a few webpages so far but am wondering if I am going about it the wrong way. I will make a main page (index.html) and then use that as a template for the rest of my site (copy and paste the code). This works great except for when I need to make a global structure change (i.e. change the order of items in the navigation) because I need to go through each page and change the html. This is just a copy and paste fix but doing it to 10 pages or so gets old real fast. How do you avoid this problem?How do you make multipage websites?This is a great question, and the whole point of using a slightly more advanced language than HTML.



In PHP, one of the most basic things you can do is write a page like this:



%26lt;? include 'header.html' ?%26gt;



%26lt;h1%26gt;Hello World%26lt;/h1%26gt;



%26lt;? include 'footer.html' ?%26gt;



you could make 30 pages this way, changing the stuff in the middle for each page, and if you want to change the navigation bar, you'd just change header.html once, and the change is applied to every page site-wide.



Of course, this is just the tip of the iceberg...
How do you make multipage websites?
Use iframes, php or javascript.. Use separate html for your navigations, header, footer etc. then just include or load those page to the %26quot;main page%26quot;. In that way, you only have to edit the page once since its only called by a script.. hope you get it..
How do you make multipage websites?
If you are able to use PHP on your site you can use PHP includes although includes do not require PHP. Lot simpler to not use it unless you plan to convert your pages to all PHP. See Server Side Includes at http://en.wikipedia.org/wiki/Server-Side鈥?/a>



This allows you to set up an include file with your site's nav menu and to add/delete just one file, upload and overwrite old include file, and have all corrections appear on every page that has the include code.



I certainly use it and saves lots of time when adding pages.



You did the right thing making a template to use for all your pages. I hope you made an external CSS file for all those pages to link to so you can edit style changes using just one file.



Your template should be set so that you can add content within the content div.



Ron