Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #10140 > unrolled thread
| Started by | Jason Bodine <jbodine1974@gmail.com> |
|---|---|
| First post | 2013-07-17 11:37 -0700 |
| Last post | 2013-07-27 11:36 -0400 |
| Articles | 10 — 9 participants |
Back to article view | Back to comp.lang.php
Dynamically changing links in a web page menu when a link is clicked Jason Bodine <jbodine1974@gmail.com> - 2013-07-17 11:37 -0700
Re: Dynamically changing links in a web page menu when a link is clicked richard <noreply@example.com> - 2013-07-17 14:49 -0400
Re: Dynamically changing links in a web page menu when a link is clicked Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-07-17 21:25 +0200
Re: Dynamically changing links in a web page menu when a link is clicked The Natural Philosopher <tnp@invalid.invalid> - 2013-07-17 20:33 +0100
Re: Dynamically changing links in a web page menu when a link is clicked Jerry Stuckle <jstucklex@attglobal.net> - 2013-07-17 16:34 -0400
Re: Dynamically changing links in a web page menu when a link is clicked Denis McMahon <denismfmcmahon@gmail.com> - 2013-07-17 23:28 +0000
Re: Dynamically changing links in a web page menu when a link is clicked bill <william@TechServSys.com> - 2013-07-18 10:21 -0400
Re: Dynamically changing links in a web page menu when a link is clicked Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-07-18 10:36 -0600
Re: Dynamically changing links in a web page menu when a link is clicked The Natural Philosopher <tnp@invalid.invalid> - 2013-07-18 19:00 +0100
Re: Dynamically changing links in a web page menu when a link is clicked Twayne <nobody@spamcop.net> - 2013-07-27 11:36 -0400
| From | Jason Bodine <jbodine1974@gmail.com> |
|---|---|
| Date | 2013-07-17 11:37 -0700 |
| Subject | Dynamically changing links in a web page menu when a link is clicked |
| Message-ID | <3b638a30-aa28-4c29-8edb-0508e376b147@googlegroups.com> |
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!
Thanks!
Jason
[toc] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-07-17 14:49 -0400 |
| Message-ID | <13p3fb9revwfc.ck1ra9q1ssp3.dlg@40tude.net> |
| In reply to | #10140 |
On Wed, 17 Jul 2013 11:37:20 -0700 (PDT), 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!
>
> Thanks!
> Jason
One possible way that comes to mind is the use of an ifrane.
Setup an iframe where the menu is to be.
Using php, have php set the values for the link they clicked.
I do something similar on my site.
When a user clicks on the year, the iframe content changes accordingly.
Not the entire page.
www.mroldies.net
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-07-17 21:25 +0200 |
| Message-ID | <5637154.vWLvGrnqvz@PointedEars.de> |
| In reply to | #10140 |
Jason Bodine wrote: > 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. > […] If this should work with server-side PHP, search for “include” and “template”. PointedEars, with a random, but surprisingly fitting sig -- When all you know is jQuery, every problem looks $(olvable).
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-17 20:33 +0100 |
| Message-ID | <ks6rh6$rgt$3@news.albasani.net> |
| In reply to | #10140 |
On 17/07/13 19:37, 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,
yes
> and if so, how do I do this?
javascript. Not PHP
> Any help is appreciated!
>
> Thanks!
> Jason
--
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.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-07-17 16:34 -0400 |
| Message-ID | <ks6upn$nkh$1@dont-email.me> |
| In reply to | #10140 |
On 7/17/2013 2:37 PM, 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!
>
> Thanks!
> Jason
>
Jason,
PHP is server side - to execute any PHP code, the client must make a
call to the server. While this can be done using Ajax, it requires
Javascript code on the client as well as PHP code on the server. As
such, I think it's a bit of overkill for what is basically static
information (the same info for the same menu item on each page).
You don't have to have the Javascript code in every page; it can be
included - and you don't even need PHP to do it. Try
comp.lang.javascript for more information.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-07-17 23:28 +0000 |
| Message-ID | <ks79at$psp$9@dont-email.me> |
| In reply to | #10140 |
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@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | bill <william@TechServSys.com> |
|---|---|
| Date | 2013-07-18 10:21 -0400 |
| Message-ID | <ks8tl8$et5$2@speranza.aioe.org> |
| In reply to | #10140 |
On 7/17/2013 2:37 PM, 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!
>
> Thanks!
> Jason
>
This is actually fairly easy to do, once you know how to use
AJAX. The click sends a request to a PHP script that generates
the sidebar code and the ajax code on the client side puts it
there. I don't use jquery, but I am sure that jquery includes
routines to do exactly that.
bill
[toc] | [prev] | [next] | [standalone]
| From | Martin Leese <please@see.Web.for.e-mail.INVALID> |
|---|---|
| Date | 2013-07-18 10:36 -0600 |
| Message-ID | <ks957o$t4o$1@dont-email.me> |
| In reply to | #10140 |
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.
--
Regards,
Martin Leese
E-mail: please@see.Web.for.e-mail.INVALID
Web: http://members.tripod.com/martin_leese/
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-18 19:00 +0100 |
| Message-ID | <ks9aes$hd8$5@news.albasani.net> |
| In reply to | #10149 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Twayne <nobody@spamcop.net> |
|---|---|
| Date | 2013-07-27 11:36 -0400 |
| Message-ID | <kt0pd6$j46$2@speranza.aioe.org> |
| In reply to | #10140 |
On 2013-07-17 2:37 PM, Jason Bodine wrote:
> Hi all,
...
Your lines are too long so I snipped them.
...
>
I do not have an answer to your question as asked, but maybe an alternative:
Why not just use Masterborders for where you need the menues
changed? The click could simply load a new page even though it's
identical or however you want to set it up, but has a different MB with
the NAV menues you want?
Also, I haven't tried it, but isn't there a way to hide and unhide
objects dynamically? That sounds like it might fit the bill.
I'm no guru and I'm sure others will come along with more specific
answers, but ... thought I'd pass along my thoughts.
Regards,
Twayne`
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web