Copy link to clipboard
Copied
I've built a simple HTML site in Dreamweaver CC and it has grown considerably over time. With each new page, I have to go through and manually update the navigation bar on every page to account for the new link. I have attempted to do this using find and replace but it is not as reliable as I would like and often creates unwanted results.
My question is, is there a way to retroactively convert the existing navigation bar to a template so that each time I make an update it propagates to every page on the site. I understand that I would have to "apply" the new navigation template to every existing page in order for them to be affected by any updates moving forward.
I would use a server side include, either .php. or .shtml, to write the menu to each page. Then, rather than making an update and uploading every page with a change (hopefully), you simply change the navigation include file and upload it.
PHP: PHP Tutorial - Include File
SHTML: Server Side Includes (SSI) Tutorial - Part 1
Basically, you would have 1 menu file that houses only the actual html needed to run the menu. Then you would place a tiny snip of code into your pages where you want that menu
...Copy link to clipboard
Copied
I would use a server side include, either .php. or .shtml, to write the menu to each page. Then, rather than making an update and uploading every page with a change (hopefully), you simply change the navigation include file and upload it.
PHP: PHP Tutorial - Include File
SHTML: Server Side Includes (SSI) Tutorial - Part 1
Basically, you would have 1 menu file that houses only the actual html needed to run the menu. Then you would place a tiny snip of code into your pages where you want that menu included in your files. When the page is requested, the server adds that include file's contents to the page where you want it and gives the completed page to the viewer.
Updating only happens on the one include file. You upload that and everything that includes it changes automatically.
Copy link to clipboard
Copied
Thank you very much for the quick and comprehensive reply. And I also appreciate the php tutorial links. They'll come in handy.
Copy link to clipboard
Copied
No not easily. Templates are a phase 1 site building step. And if your site is sizable and still growing, Templates are not a good long-term solution. Sites built with Templates should not exceed about 50 pages and some would argue they shouldn't exceed 20. But that's another discussion.
Server-side includes are the best way to handle common site elements like navigation, headers, footers, etc... Open a file, edit, save, upload to server. Done. Your entire site is updated by the server.
Alt-Web Design & Publishing: Server-Side Includes with PHP
With Templates or Library Items, you have open the main template, edit, save changes and populate to child pages. Check to ensure all child pages are populated correctly and then upload every child page to server. Even on small sites, this takes a lot of extra time.
Nancy
Copy link to clipboard
Copied