My website is http://bostontechnicalwriter.x10host.com/
My navbar section is exactly the same in my index page and each of my subject pages (Blogging: Electronic Products Magazine, IEEE Globalspec, etc, etc.)
Right now, if I want to add or delete one of the subject pages, I have to modify the navbar not only on the index page, but in each of the dozen or so subject pages. This is a cumbersome, error prone task. Is there any way to write only one navbar, and have it apply to the index page and all the subject pages?
BTW: Are "Navbar" and "subject Pages" the correct words?
You can define your menu once, then 'include' it using a server side language. What languages does your host support? (PHP, ASP or ?)
Hi Charles,
I use x10hosting, and at:
https://x10hosting.com/hosting-features
it says:
Complete Control
Want to write your own PHP scripts
or install a third-party package?
Sure!
So I guess that means I have free access to pHp
- Gary
Ok, so you have PHP to use. The first thing to know is that any page that contains PHP code needs to have a '.php' extension and must be served up thru a web server. In theory, you could change the '.php' requirement by changing your web server configuration. I stay out of that part.
Next, create your menu page (save it as 'menu.html', for example). Only include the menu parts, do not include <head> or <body> or any other parts.
Now, on each page that will have the menu you need to add something like this:
Hi Charles,
I'll give this a try.
Thanks!
Gary
Hi Charles,
Your idea worked. I tried it out on a new free host, the modified website is:
https://exper17.000webhostapp.com/
I Inserted this command into each page:
<!-- Left Column, Navbar division -->
<?phpinclude('navbar.php');
<!-- End of Left Column, Navbar division -->
as for navbar.php itself
(after I took out most of the menu choices to save space in this note, they are all about the same):
<!-- Left Column, Navbar division -->
<div id="left_col">
<table style= "width: 100%" cellspacing="8" cellpadding="2">
<tr style="background-color: #ffcc33;">
<td style="width: 100%"><a href="index.php">Home</a></td>
</tr>
<tr style="background-color: #ffcc33;">
<td style="width: 100%"><a href="softwarewriter.php">Software Articles</a></td>
</tr>
<tr style="background-color: #ffcc33;">
<td style="width: 100%"><a href="scopejunction.php">Scope Junction</a></td>
</tr>
<tr style="background-color: #ffcc33;">
<td style="width: 100%"><a href="gmvolt.php">GM Volt</a></td>
</tr>
</table>
</div><!-- End of Left Column, Navbar division -->
Now, I only have to modify "navbar" in one place only when I want to change my choices. So, thanks again for your help!
Regards,
Gary
Great, glad it worked out for you. One thing I did see that needs fixing, maybe if was just a copy and paste error. This line of code:
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)