July 9, 200917 yr Hi, I'm new so like I've posted before please persevere with me on topics you may find tediously simple... Im looking for a way in which content can be dupilcated throughout a website in the same way formatting in a website is all controlled by one or two css files. Allow me to elaborate... If, for example, I begin putting together a small website of say 6 pages in HTML I will no doubt want a menu system to navigiate it. The navigation may go as follows along the top of each page; home, gallery, sales, projects, contact, about, how do i change the menu system on one page so that all pages display the changes; home, gallery, SERVICES, projects, contact, about... I don't want to have to go into each of my 6 pages and change the code for each menu individually. I know this could be done with dreamweaver mx editable/non editable regions but is there a less fiddly way? Footer content on each page needs to stay exactly the same throughout on most sites also so the same would apply to this. If you want to change the content in your footer do you have to alter the html code for each page? Please help
July 9, 200917 yr Is PHP an option? I can quite easily write you something to load the the menu from 1 file. Sam
July 9, 200917 yr Yeah you could just use a php include to load the nav on all the pages from a single file, then when you need to change the menu, just update that one file. http://www.tizag.com/phpT/include.php
July 9, 200917 yr if PHP isn't an option then you could just do a FIND/REPLACE in dreamweaver and set it to Entire Local Site. Be careful with this though, you don't want to overwrite a load of stuff by mistake! PHP is the best option though
July 9, 200917 yr on mentioning dreamweaver - it does have a template system itself if that is what you are using... .dwt files i think .. you make a basic template for the site and choose what is editable in separate html files.
July 9, 200917 yr Author thanks ever so much for the quick replies guys. i wouldnt even have thought about PHP. Ive only been learning HTML&CSS the past 18 months or so and before that it was "drag and drop" in dreamweaver whilst skimming the surface studying for my business degree. At the momment im only putting togeter small sites > 8 pages so repeating/changing code wont get too frustating but the php solution sounds the best easy... when ive developed my html/css to what id regard a satisfactory level, php will be the next step. I was looking for a similar idea to css files and how they cascade style and formatting throughout a site from just one file. thats a great idea. what methods do u guys actually do though in your own designs?? dreamweaver isnt a bad idea - the find replace thing is a simple but maybe uncertain solution that could work still! i found the editable regions templates .dwt files TOO restricting when I first came across them at university. this is all execellent stuff tho, nice one.
July 10, 200917 yr The best way Is definately PHP. All you have to do is create a file (menu.php for instance). Put your menu in xhtml into menu.php. Then in your file where you want your menu to show is do this : <?php //Im presuming menu is in a folder called "template-files". include_once($_SERVER['DOCUMENT_ROOT']."/template-files/menu.php"); ?>
July 10, 200917 yr Author The best way Is definately PHP. All you have to do is create a file (menu.php for instance). Put your menu in xhtml into menu.php. Then in your file where you want your menu to show is do this : <?php //Im presuming menu is in a folder called "template-files". include_once($_SERVER['DOCUMENT_ROOT']."/template-files/menu.php"); ?> Skidz, you've been a big help there thanks for taking time to write that out for me, I'll definately have a play with that before my next project! One question on that though, PHP is a server side language yes, so when I create a domain etc for a future site the server will have to be PHP compatible wont it? My home site that I'm updating at the mo is working from an .ASP server I think. Thanks again!!
July 10, 200917 yr Author oh one more thing - how will I format the xhtml code with css if its in a .php file. same as I would normally?
Create an account or sign in to comment