Re: Dynamically changing links in a web page menu when a link is clicked [message #182195 is a reply to message #182189] |
Wed, 17 July 2013 23:28 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Wed, 17 Jul 2013 11:37:20 -0700, Jason Bodine wrote:
> I am designing a website for my company. The site will have a JQuery
> accordion menubar across the top and a sidebar menu as well. What I
> would like to do, using php in order to save myself the trouble of
> cluttering my html with menu code on every single page on the site, is
> make it so that when someone clicks on a link in the menubar, the links
> listed in the sidebar change according to what was clicked.
To do this at the php level implies some sort of reloading of the page,
or at least the sidebar (is it in a separate frame?) when the menu link
is clicked, with the relevant submenu data loaded.
If you want this to happen inside the page without a reload, that's
something you'd want to do client side, and that's not really a php
issue, although you might use an ajax request in the javascript code on
the client to ask the server for the relevant menu links to display.
You mention jquery - the normal suggestion in this case is to go and find
a jquery forum and ask the question there. There are probably other
javascript methods to do this, but they would be equally off topic here,
but perhaps on topic in comp.lang.javascript - however that latter group
is generally dismissive of jquery (and indeed most libraries) and will
probably suggest that you find a more relevant forum.
So, I think that first of all you need to decide whether:
(a) the menu change is going to happen with a page reload
(b) the menu is going to be in a frame and the menu frame will reload
(c) the menu change is going to happen client side using submenu data
provided as part of the initial pageload
(d) the menu change is going to happen client side using submenu data
provided in response to a menu click
Then you will know what data you need to provide, when to provide it,
what stimuli will trigger its provision, and whether you';re going to be
working client side or server side or both.
Once you know what bits you need to do server side in php, come back and
ask here if you need any help with them.
--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
|
|
|