theniteowl
Programmer
Hi All,
I am working on a dynamic navigation menu in a web site where everything is maintained within a template.
Each menu option passes values on the URL to indicate the current selection state of the menu so when the new page loads I can set the correct menu options (top and sub menus) as well as highlighting to visually show which option is selected.
Content pages load within a content area in the template.
The problem is, if a client adds links in their content page I have to be able to append the menu selection information to that link as well. My current method is to have them insert <?= $linkurl ?> within the HREF of the link if the link is to a page on their own site rather than external. I do not like having to make the clients do something special to their links in order to maintain nav menu info.
Is there a better way to persist this info?
Should I use something like session values to maintain the current menu selection info?
Or can I parse the links in the included HTML page to modify them at load time?
Are there other approaches I am not yet aware of?
I knew nothing at all about PHP when I began this project and learned as I went so there are a lot of gaps in my knowledge of the language.
My goal is to not have to rely on javascript for the navigation and do it all server-side while not requiring the clients to do anything unusual in their pages other than making sure they keep within the constraints of the available viewspace.
Also, selecting an item in the top level of the menu reloads the page and sets up the second level of options based on the top level selection. Is there any way with PHP to do this change without reloading the whole page?
I think not simply because I am doing it with server-side code. I could do it easily in Javascript but want to keep the navigation code server-side so it should always work regardless of browser settings.
Ideas?
Thanks.
Stamp out, eliminate and abolish redundancy!
I am working on a dynamic navigation menu in a web site where everything is maintained within a template.
Each menu option passes values on the URL to indicate the current selection state of the menu so when the new page loads I can set the correct menu options (top and sub menus) as well as highlighting to visually show which option is selected.
Content pages load within a content area in the template.
The problem is, if a client adds links in their content page I have to be able to append the menu selection information to that link as well. My current method is to have them insert <?= $linkurl ?> within the HREF of the link if the link is to a page on their own site rather than external. I do not like having to make the clients do something special to their links in order to maintain nav menu info.
Is there a better way to persist this info?
Should I use something like session values to maintain the current menu selection info?
Or can I parse the links in the included HTML page to modify them at load time?
Are there other approaches I am not yet aware of?
I knew nothing at all about PHP when I began this project and learned as I went so there are a lot of gaps in my knowledge of the language.
My goal is to not have to rely on javascript for the navigation and do it all server-side while not requiring the clients to do anything unusual in their pages other than making sure they keep within the constraints of the available viewspace.
Also, selecting an item in the top level of the menu reloads the page and sets up the second level of options based on the top level selection. Is there any way with PHP to do this change without reloading the whole page?
I think not simply because I am doing it with server-side code. I could do it easily in Javascript but want to keep the navigation code server-side so it should always work regardless of browser settings.
Ideas?
Thanks.
Stamp out, eliminate and abolish redundancy!