Jump to content

Variable Php Navigation Bar


Skatiechik

Recommended Posts

The navigation bar on my website is currently seperated into a different html file and included via the use of the php includes function (website found here http://www.maestroturbo.org.uk). Very good as it means I only update one html file to change the navigation bar for the whole site.

 

However how do I make this dynamic so I can have 2/3 levels below?

 

So at the moment it is

 

# Photo Gallery

# Events - MGSD06

 

Now how do I write the php so I can change it to

 

#Photo Gallery

#Events

#####Event05

#####Event06

#Technical

Just to say I know nothing about PhP except the includes seperation so don't confuse me. Willing to learn though

Link to comment
Share on other sites

Simply add a new link in

 

<li><a href="page to go to">Page name</a></li>

 

Yes, but I don't want another first level link though. I wrote the website initially, I think if I can manage to add about 10 first level links then I can manage another ;) I am asking how you make the navigation bar "dynamic".

Link to comment
Share on other sites

You need to do the navigation bar using Javascript.

 

There are quite a few examples of this sort of code on the Web, and you can usually write a bit of PHP that will write out the Javascript for the menu, assuming the 'sub-level' entries are based on database contents. If they're not, than you should just be able to code the nav bar in Javascript in the include.

 

I know this is a bit 'woolly' but hopefully it'll point you in the direction to look. :)

Link to comment
Share on other sites

Well I am glad someone knows what I am talking about. I wondered if I was talking in double dutch on my first post.

 

No the links aren't database entries just html, but as I have the php includes function in yes hence these are name arandomlink.php

 

I have used dynamic javascript navigation bars before, very recently for another website in development and mixed it with some PhP. Cheers for twigging my memory. The only issue I have is the free scripts seem to be created for certain graphical layouts and I wish to keep exactly the same one. I thought they may have been an easier way of doing it using php.

Link to comment
Share on other sites

Well I am glad someone knows what I am talking about. I wondered if I was talking in double dutch on my first post.

 

No the links aren't database entries just html, but as I have the php includes function in yes hence these are name arandomlink.php

 

I have used dynamic javascript navigation bars before, very recently for another website in development and mixed it with some PhP. Cheers for twigging my memory, I don't know why I didn't think of that. I will go and see if I can steal a script from somewhere or use my existing one.

 

You know what Picasso said; 'Good artists copy, great artist's steal'. :)

 

Good luck with it!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.