Re: Dynamically changing links in a web page menu when a link is clicked [message #182199 is a reply to message #182198] |
Thu, 18 July 2013 18:00 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 18/07/13 17:36, Martin Leese wrote:
> Jason Bodine wrote:
>> Hi all,
>> Please excuse me if this question has been asked before, but I am new
>> to php and can't seem to find the answer to my question anywhere.
>>
>> 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. For
>> example, if someone were to click on "About" in the menubar, the
>> sidebar would display different "About"-related hyperlinks ("About
>> Us", "Management", "Our Staff", "Job Opportunities," etc.) and then,
>> if the user then selects "Products and Services" from the top menu,
>> the side menu would change with a list of new links related to that one.
>>
>> Is this possible, and if so, how do I do this? Any help is appreciated!
>
> Other people have suggested using AJAX.
> Alternatively, you could include all the
> options as HTML in your sidebar, but then
> make all but one of them invisible using
> the CSS {display: none;}. Then, when the
> user clicks on a link in the menubar, use
> JavaScript to change what HTML is made
> visible in the sidebar.
>
> Whichever way you do this, PHP will not do
> it. PHP just generates HTML (perhaps in
> response to a JavaScript AJAX request).
> This is therefore the wrong newsgroup.
>
the only way you can do it server side is to cause any click to reload
the page, or part of the page from the server.
But invisible divs are cheap enough, if you don't mind using javascript
to handle the context sensitivity, and its a hell of a lot faster.
--
Ineptocracy
(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
|
|
|