PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi!
Can anyone suggest what is the best way to make breadcrumb navigation using php & mysql? (I mean what would be the best structure for tables in database, it will be also helpful if someone will provide a lil' example of php code. )
Yea really. I am working on this same problem myself.
I have some ideas.
Making 2 tables. One with URLID, URL, AND URLINFO, the other with PARENTID and URLID. link the URLID with primay/foriegn keys,t hen whenver a URLID Is called , have it also call the parent URLID's with use of PARENTID...
So my idea was that when the page loads, the php will check and see what the filename of the page is say TEST.php, then it will SELECT all from DB where URL= Test.PHP, then output the information along with it.
My only problem is, how will we track which links go before it...
Phenom wrote:$_SERVER["http_referer"] will tell you where you came from
But that working successfully is dependant on the browser, and only shows the previous page, not a trail of pages.
My suggestion would be to use a cookie. When each page is loaded, or when a new directory is entered, add it to the cookie. Then, have a script that breaks apart that cookie and uses it to create a breadcrumb trail.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Another option is to actually have the files in a breadcrumb-type directory structure, then just parse the current working directory ([php_man]getcwd[/php_man]()) to get the breadcrumb trail.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Another option is to actually have the files in a breadcrumb-type directory structure, then just parse the current working directory (getcwd()) to get the breadcrumb trail.
hm...maybe someone will post "database method" of breadcrumbs...