I inherited some code that is using a DOMDocument object with an associated XML sitemap to display breadcrumbs. The breadcrumbs are displayed just fine and are accurate. The only problem is that certain pages use query strings, and these query strings are being saved as attributes (i.e. DOMAttr) and being stored in the XML sitemap (which is being shared by every user). One user can overwrite the query string of another user. Heres an example: User A is currently on "Edit FAQ" and his breadcrumbs are as follows. Home -> Manage Page -> Edit FAQ Where the link to manage page is domain.com/admin/pageInfo.php?id=50 The XML sitemap looks something like: <adminMenu title="Main Menu"> [INDENT]<pageInfo title="Manage Page" id="50"> [INDENT]<editFAQ title = "Edit FAQ /> <edit...[/INDENT] </pageInfo>[/INDENT] </adminMenu> Code (markup): While User A is on "Edit FAQ", if User B shows up and navigates to the Manage Page node with a different query string (say he goes to domain.com/admin/pageInfo.php?id=2), User A now has an inaccurate breadcrumb at the Manage Page node if he refreshes his page or goes deeper into the tree. I'm not very familiar with the DOMDocument class. Is there an easy fix to this or does the whole breadcrumbs structure need to be reworked for this site?
Dont use DOMDocument class and XML to manage your breadcrumbs, very bad idea simply because your storing data on your filesystem(the xml file) about each of your visitors and this is not the correct way to go about in doing such things. Instead choose another approach and create an array of all possible page names or perhaps pull them from your database and handle them in your PHP code. If you need to store data about each user, it's generally done through PHP SESSIONS or if you want you can also try storing the data in your database but most people wont do that because database is very slow for such things whereas handling the solution in your php code with SESSIONS will be much quicker.