Jump to content

Nav items under different sections


kurt.santo
 Share

Recommended Posts

On a site, which has navigational items, which might show in more than one section: Does it make sense to create a database table nav with the columns: item, link, section1, section2, section3 etc and query in web page as "$query="SELECT item,link FROM nav WHERE section1=true;" or sth similar? With true I mean that there is the boolean is set to yes. How would I be able to get the link text into the src the <a/> link, which surrounds the link text (from link)? Hope you understand what I mean...In an other of my posts I learned a lot about PHP includes (again a big THANK YOU for your help). If there is a way to achieve what I am after without databases I welcome anyone to make suggestions to a poor soul;-)Kurt

Link to comment
Share on other sites

If the data rarely changes, why not an include? Have the navbar code in a file which you drop into your page as you need it.Avoids the Database overhead entirely.Or write a script to read the Link information from a flat (text) file. I wrote a small script for that some time ago. I'll see if I still have a copy and post it up.*edit*Don't laugh... I wrote this a long time ago and have learned a few things since then... but it still works... reads a text file and creates the menu you see on that page from the data. Edit the text file to Mod the menu, rather than tearing into the php file.http://www.jlhaslip.com/template/?page=twoHow old is it? Notice I have both title and Mozilla used title and IE used Alt... and I never knew which one worked, so I put both of them in ... been a while... Might want to drop the Alt=. Doesn't validate with the Alt= in there...

Link to comment
Share on other sites

If the data rarely changes, why not an include? Have the navbar code in a file which you drop into your page as you need it.Avoids the Database overhead entirely.Or write a script to read the Link information from a flat (text) file. I wrote a small script for that some time ago. I'll see if I still have a copy and post it up.*edit*Don't laugh... I wrote this a long time ago and have learned a few things since then... but it still works... reads a text file and creates the menu you see on that page from the data. Edit the text file to Mod the menu, rather than tearing into the php file.http://www.jlhaslip.com/template/?page=twoHow old is it? Notice I have both title and Mozilla used title and IE used Alt... and I never knew which one worked, so I put both of them in ... been a while... Might want to drop the Alt=. Doesn't validate with the Alt= in there...
Cheers! Will have a go at it. This might be the solution. The data changes all the time, is a site for a friend who wants to change his products regularly... I will let you know how I got along. Might take half a year until I get back to you as my brain is still struggling badly;-) (but am getting there:-))kurt
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...