Forgive me I am relatively new to website biulding. So let's say I am making a website for whatever and I need to set a up a navigation menu or something. And after that is done I need to ad another page to my website. I would take the new link code and add it on to every page that I already have. This would be easy if my site had 5 pages but what if it had 100 pages ? How do I automate the proces ? How do I organize my websites page and make sure updating (new pages or erasing other pages) is not a big time consumer ?
There are two routes that people normally take, either have the navigation in a separate file and then use it as an include on all your pages so that you only have to update it once and all pages then have the update. Alternatively use a CMS type system which automatically updates the navigation each time a page is added/ removed
If you server allows for PHP create a header.php and footer.php. The code would be: header.php <html> <head>stuff in here...</head> <body> Navigation and header stuff... Code (markup): footer.php footer stuff... </body> </html> Code (markup): index.php <? include("header.php"); ?> <p>Welcome to my awesome site.</p> <? include("footer.php"); ?> Code (markup):
I agree with LeetPCUser, using includes is the best way to go. You upload the header, the footer, the sidebar o whatever you have once, and that action updates all of the pages.
For making dynamic sites so that you update a header file and all pages get updated, you have two options. One was already explained and is using PHP. Each page has the extension 'php'. The other option is to use SSI includes. Each page has the extension 'shtml'. To include a header file, you will use this syntax. <!--#include file="included.html" --> Code (markup): If you want to avoid the overload of having a dynamic site where each page is created on-the-fly, you may use an automated system that rebuilds the whole site at home, and send everything via FTP. You spend a little more time in updating, but your visitors get their pages quicker. This is feasible for small sites up to about 200 pages.
Thx for the advice I will use it. Is the php method 100% ... safe ? I wont loose like a few % of my visitors by making all my pages 100% php ? I just don't big websites with lots of pages using all php.
of course it's safe.. in fact, almost all the "good" websites are built using PHP or ASP (it's similar with PHP but for windows server)..today, static websites are dead, people love dynamic more. good luck. you can start learning php at w3schools.com
I think he meant compatibility terms. PHP is server side so your viewers will not have any problem with PHP pages.
He pretty much nailed it on the head... here is some more information on the include function: http://www.tizag.com/phpT/include.php You might also want to check out using Wordpress... it's a great way to automate your entire site without bothering to learn PHP.
It won't load slower or something show up screwed in other browsers, right ? Just had to ask Is'nt wordpress just for blogs ? While I am on the subject of organizing my website, I have to ask before I begin building it. How do I manage my ads ? There will be 2 spaces for ads on each page. Thats a lot of ads and if I want to change advertisers or decide to ad another 3-d space or something that take a lot of work. Can I use the include tag to place my ads in a separate file ? Would that make any problems I can't think about now ? How do you manage all your ads ? Oh, and if I want to display ads from 2 separate advertisers, how do I do that ? Say 40% adsense and 60% another advertiser and can I have some kind of analisys software or script to tell me what is going on, which is doing best ? Boy, I have a lot of questions Thx all for your help.