View Full Version : how to create a sitemap path in PHP?
qpixo
January 16th, 2006, 12:26 AM
Hi all!
does anyone know how to create a sitemap path in PHP? So you really know in which section of your site you're currently into...
ironikart
January 16th, 2006, 03:54 PM
You mean breadcrumbs?
Something like that, to do it successfully, requires that the pages have some sort of relationship with each other. The way I normally achieve it is to setup my database + php to store entries for each page in a heirarchial structure. Google up 'modified preorder tree traversal' and you'll get a really nice solid method for storing information in a tree. To get the 'breadcrumbs' of a page all you have to do is write a query that gets the path to the current page.
Here's a link that might help:
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
qpixo
January 16th, 2006, 06:03 PM
Ok let's say, main menu and it contains several options. Now, I'm selecting "skills" which is a sub menu option of "about"
It will display that way :
Home | About | Contact
about > skills
which I'm currently in that page
I believe you can merely do it with a XML file which u define all menu options. But how can you interact with the menu?
You mean breadcrumbs?
Something like that, to do it successfully, requires that the pages have some sort of relationship with each other. The way I normally achieve it is to setup my database + php to store entries for each page in a heirarchial structure. Google up 'modified preorder tree traversal' and you'll get a really nice solid method for storing information in a tree. To get the 'breadcrumbs' of a page all you have to do is write a query that gets the path to the current page.
Here's a link that might help:
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
qpixo
January 16th, 2006, 06:04 PM
Is there a way to do it while using XML file and PHP codes?
btw, it's a dynamic menu
Sniper Jo
January 17th, 2006, 11:07 AM
Well if you have php files or in an order say u have skills in Portfolio/Skills you could cycle through select folders strip the .html or .php from them and display the data in a table which would show the page names and sections..
EDIT : :!: opos i just read the question properly.. but ill leave the post there :P
ironikart
January 18th, 2006, 04:52 PM
If you want to go down the xml path of storing you're menu data you still need a way for the nodes to relate to each other somehow. Eg:
<menu>
<item name="Home" />
<item name="About" />
<item name="Skills">
<parent>About</parent>
</item>
</menu>
Then when you are doing you're parsing you need to create a data structure that holds the relationship (probably a series of lookup arrays) and allows you to access a full history.
I wouldn't recommend going down this path, it's hard to manage and scale and probably more work to write you're parser. Plus MPTT is much neater. If you don't have a database available to you PHP ships with SQlite (file-based database).
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.