AlfieWebDevTips Homefor new and experienced developers
[Home Home] [Web Development Web Development ] [Code Generators Code Generators ] [Resources Resources ] [Contact Us Contact ] |WebDevTips Privacy Privacy |
Print This Page

You are here : Home - Web Development - PHP - Expanding Navigation

Expanding Navigation



what is it?

Basically you have your main link that, when clicked on opens sub navigation under the main link.

It is really easy to create this using php. All you have to is pass a query string (or an in page variable) to the page you are loading. The nav checks to see what subnav to display - its that easy.

All you have to do is build your navigation complete with all the sub links. You enclose the sublinks in a simple if statement. So if you make your url page.php?linkid_1=1 then your if statement looks like this
if($linkid_1){your sublinks here}

Take a look at a demo page - there are no bells an whistles, just the bare bones so you can see how easy it is. It's up to you how you implement it on your site but the principle is basically the same.

If you don't want to pass a query string you can set the variable required on the page that's loaded. for example
<?$linkid_1=1;?>
as long as you place that before your navigation it will work.

View the demo source.

As you can see it's really easy to see how it all works. What's more its really effective and only a few lines of php code.


Got any comments? Why not share them in our forum :)
31-Mar-2003




Google
 

[back to top of page]   

[labelled with icra -  - this link will open in a new window] [RSS Content]

[Copyright © WebDevTips]