Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Making/coding a website: how to do the navbar?

Author
Message
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 2nd Feb 2009 01:13
I don't want to have to edit all my pages if I want to change something on my navigation bar.

I can't use frames (multiple html files opened in different parts of the window while you're actually always on the index page), because then, noone will be able to link to a specific page.

I also don't want to do it with tables and includes as described here:
http://www.d-a-l.com/help/web-development-help/1314-navigation-bar-without-frames.html

I'm not very experienced in html coding. How would I create a navbar in a way I don't have to edit all my sites for small changes?

bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 2nd Feb 2009 01:15 Edited at: 2nd Feb 2009 01:17
There is no other way, unless your HTML editor supports such an option through the use of HTML templates.

You could also use PHP, (or similar programming language). The PHP syntax would be:



Wherever in your HTML script you want it to show up. Also you'll need to name your HTML file with a .php extension (like, index.php), in order for PHP commands to work in most cases.

"I acctually quite like this site. And noone will know because this is a secret..." - Anonymous
Shhdb.com
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 2nd Feb 2009 01:15
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 2nd Feb 2009 01:17 Edited at: 2nd Feb 2009 01:18
Look it up in your HTML editor's help file, it's not a standard HTML feature. It's basically where your editor updates sections of HTML code across your website, if your editor even works that way. Also, I edited my above message with some more info.

"I acctually quite like this site. And noone will know because this is a secret..." - Anonymous
Shhdb.com
Omega gamer 89
17
Years of Service
User Offline
Joined: 10th Sep 2007
Location: Pittsburgh, PA
Posted: 2nd Feb 2009 03:57
If you just use notepad or anything like that, you probably can't use templates. You need something like Dreamweaver that has a site manager to do it.

If the good lord had intended us to go outside or have a social life, he wouldn't have invented the internet.
www.threeswordsproductions.com
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 2nd Feb 2009 12:39
I have Dreamweaver, how to do that there?

thx for the help so far btw

Quadrazar
16
Years of Service
User Offline
Joined: 7th Jan 2009
Location: onboard the Kobayashi Maru
Posted: 2nd Feb 2009 13:25 Edited at: 2nd Feb 2009 13:27
In dreamweaver you can create frames. (I can't remember the code for frame, but you can do it visualy). You'll have to end up whit an indexpage.html that contains the code for the framedefenition.
A navBar.html that is loaded in the navbar frame. And the contentframe that contains your opening_page.html.



You 'll have to name your frames to get the linking right.

for the links in the navbar use someting like

for the links int the content use someting like


Amiga 500 - 68000 processor / 7 Mhz, 512 Kb RAM, 4-channel PCM synthesizer (stereo)
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 2nd Feb 2009 13:33
I already have that, but I don't want this because I can't give people a link to a specific page like this. (you're always on index.html)

Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Quadrazar
16
Years of Service
User Offline
Joined: 7th Jan 2009
Location: onboard the Kobayashi Maru
Posted: 2nd Feb 2009 14:08 Edited at: 2nd Feb 2009 14:13
use a javascript and a request variable like index.html?page=welcome.
here is an example of a function that reads request variables. Once you have the request variable, use someting like
where the frame is defined.
in your navbar make your links like this

there might be better ways to do this, but this sould do the trick.

[EDITdidn't see that the problem was already resolved.

Amiga 500 - 68000 processor / 7 Mhz, 512 Kb RAM, 4-channel PCM synthesizer (stereo)
Jeff032
17
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 2nd Feb 2009 14:39 Edited at: 2nd Feb 2009 14:39
Just FYI, using Apache's XBitHack would be faster than using PHP for includes. You would do something like this:



The file with the include would need to have execute permissions.

bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 2nd Feb 2009 16:28
Ye, but that would require special overrides or server config.

If you got php with your hosting, it'll work everywhere without any further thought

But anyway, if you're doing straight HTML, Dreamweaver templates are the way to go.

"I acctually quite like this site. And noone will know because this is a secret..." - Anonymous
Shhdb.com
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 2nd Feb 2009 23:57 Edited at: 3rd Feb 2009 00:08
Thanks again guys, I did it with the Dreamweaver templates.
I'd just like to know if it's possible to have the navbar always at the same screen position, so it'll stay where it is when you scroll down (not go up).
This was easy with frames (you just scrolled the content frame), but is this also possible using tables & dwt templates?


This is the result so far btw:
http://www.hurricane-eye.webs.com/

(I didn't want to spam with that btw)

Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 3rd Feb 2009 00:12 Edited at: 4th Feb 2009 13:06
That's strange, if I link it with index.html on this forum, it'll show some strange version of it:
http://www.hurricane-eye.webs.com/index.html/

EDIT: works like this:
http://www.hurricane-eye.webs.com/index.html

While on other sites, I can do it with the index.html without problems...

Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Feb 2009 01:18
Not frames, but what about a frameset?

Your signature has been erased by a mod because it's larger than 600x120
Lazlazlaz 1
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location: England
Posted: 3rd Feb 2009 11:17
Quote: "That's strange, if I link it with index.html on this forum, it'll show some strange version of it:
http://www.hurricane-eye.webs.com/index.html/

While on other sites, I can do it with the index.html without problems..."


it is the extra forward-slash after the .html

It treats it like a folder so any files you include (like your style.css file) are not found correctly as it is looking in a wrong, and non-existant, folder.

Sioux - Hollywood Western Style RTS - Possibly coming soon if I don't give up on it again.
pollywog
18
Years of Service
User Offline
Joined: 18th Jan 2007
Location:
Posted: 5th Feb 2009 23:05
make your navigation bar a user control and plug it in to all your pages.
here is one I did for a header that I display on every page of the app first you make a .ascx file then include it in all you .aspx files

here is the ascx file


then just include it in your other pages.
<%@ Register TagPrefix = "Flashback" TagName = "Header" src="Header.ascx"%>

then you can use it in that page.
<FlashBack:Header runat ="server" />

this is using asp.net but I'm guessing there is something similiar for whatever your using.
NeX the Fairly Fast Ferret
20
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 5th Feb 2009 23:37
Is that IE specific code I spy there? Sure looks it.

What good is knowledge without a degree of understanding?
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 6th Feb 2009 15:20 Edited at: 6th Feb 2009 15:21
It's aspx code. I assume it's parsed just like PHP, ie, server-side, browser independent.

Oh wait, ye, I see, in the HTML code snippet? Tisk tisk

"I acctually quite like this site. And noone will know because this is a secret..." - Anonymous
Shhdb.com

Login to post a reply

Server time is: 2025-06-07 21:01:08
Your offset time is: 2025-06-07 21:01:08