Hey pro,
I have a problem! every time I create a website from my template, which I created, I always need to edit every pages if I want to add another navigation link. Imagine I have 20 pages, and I want to put a new navigation link on my template, it needs me to open up every single page to edit just for the new link.
May I know if there is any way, for it to, just change one template and it will affect every single one?
I am using notepad++
Please help.
Thanks
Steve



1)
If you hard code each link then there is no way. You need a way for each page to dynamically load the links. Then you can put the links in a separate file or you could use a database. To do this, you can learn some javascript and put the links in an external javascript file, or you can get into server side languages like PHP, ASP, or even PERL.
2)
The other option would be to use web design software that would allow you to replace the text in every document. This would still be hard coded but the software would make the changes automatically.
Use SSI – server side includes or php includes if you’re using php. Do a google search for server side includes. It will be a little work to set up, but once you do you’ll wonder how you lived without them.
The problem with notepad++, there is no design view. Just lots of code. Get dreamweaver, or the free alternative,
eclipse: http://www.eclipse.org/
Maybe. I use Notepad++ as well, but I’m fairly new to it. All I do is write the code and appreciate the pretty colors as opposed to the eye sore Notepad which I’m used to, haha.
tags, just the code. Save it.I say maybe, but I haven’t experimented with it any yet.
Something I KNOW works, though, and is a bit more reliable I’d say, is PHP.
You usually save your files with the extension, “.html” but with PHP you use “.php” at the end instead.
PHP has a plethora of functions, but the only thing we, as casual web designers, have to worry about is a function called “include” (or “require,” but since my designing is all offline I prefer “include”; for more information, Google “PHP include and require”).
Let’s say you have a Navigation Bar (for example, “nav”) that you want on every single page, but when you update a link, you don’t want to have to load the HTML for EACH page and change it. PHP achieves this.
What you do is you set up a file (in my case “nav.php”) in the same place that the rest of your pages are, and change your main page (usually “index.html”) to “index.php” — don’t touch any code yet, we’re just changing the extension.
Now, in your file “nav.php” place all HTML code that applies to the navbar there. No
Now, in your “index.php” file, highlight all the code you just copied, and in its place type in < ?php include("[filename]"); ?> with [filename] being your file including the extension. So in my case (taking this straight from my code) my main page’s raw code for the navbar looks like this (
THAT is your navbar, and THAT is the ONLY thing you have to worry about updating, and on every page you put the above code in, as soon as you hit “save” on nav.php, they will all instantly update. Even better, you don’t even have to know PHP, just the above statement. So now no more worries about that special “Christmas theme” you want on your site. =)
———-If you have a web host, then check to see if they have support for PHP, which they should. If not, you’ll have to look for another kind of SSI (Server-Side Include). Also, the below is only if you want to work offline and test it before uploading to your site. If that’s not a concern with you, then you don’t need to follow the below instructions (including the links at the bottom)———-
The downside is you have to set it up, meaning, unlike HTML, it doesn’t just automatically render. Now, don’t be intimidated, as it’s not so bad once you find the right information (took me two days of hair pulling, but I’ll give you the links that helped me to save you the time). I’ll warn you, it’s a slight pain to set up, but it’s worth EVERY second, and I don’t regret it.
Basically all you’re doing is you’re going to install Apache (a web server) to run locally (offline) on your computer. This will allow your browser(s) to understand the code.
Then you’re going to install PHP. The current version at the time of writing this is PHP5, so just grab the latest .zip folder for your system, download it, and follow the instructions in the links I’m about to give you. After you do that, you’re all set and you’ll never have to touch it again.
(Just a suggestion, use regular Notepad for these tutorials, and when it tells you to find and edit something click on “Edit->Find…” and type it in. When the tutorials say to “uncomment” something, they are talking about a semi-colon (“;”) at the beginning of the line.)
~Best wishes!
Zane & Azaria