Page 1 of 2

Jump Menu

Posted: Thu Oct 20, 2005 8:15 am
by steve
Hi All,

I need to add a jump menu toa a site that the end user will be able to edit in the admin. At the moment I have just supplied some extensive notes one how to edit the the html. I'm a little scared of this but it's my only option at the moment.

The current jump menu can be seen here:
http://www.polypostalpackaging.co.uk/index.php

I was wondering how difficult it would be to tweek the FeedbackForm module to do this. It seems simple, turn off the submit button and add an 'onChange' javascript in the form and add the corresponding function someplace.

I have just had a look at the FeedbackForm code and thought that I'd better ask for some advice before I start hoookying aroung in there.

Any advice appreciated

Steve

Re: Jump Menu

Posted: Thu Oct 20, 2005 11:55 am
by Ted
To be honest, I think you could take bulletmenu and modify the output into a select box without too much trouble.  Would have to write a little javascript to grab the url value and redirect to it onChange, but it should be pretty simple.

Re: Jump Menu

Posted: Thu Oct 20, 2005 12:13 pm
by steve
Thanks Wishy, I'll have a look at that :)

Re: Jump Menu

Posted: Thu Oct 20, 2005 9:38 pm
by steve

Re: Jump Menu

Posted: Thu Oct 20, 2005 11:55 pm
by iNSiPiD
Did u do all this for one link?

If you've gone to the trouble of converting the bulletmenu code to output as a select box I'd be interested in seeing the code.

Thanks! Nice site by the way.

Re: Jump Menu

Posted: Fri Oct 21, 2005 9:21 am
by steve
Nope, It all just works like the bullet menu but spits out a drop down.
I'll post the code as soon as I get home after work.

:)

Re: Jump Menu

Posted: Fri Oct 21, 2005 5:50 pm
by steve
I've attached the bulletmenu/jumpmenu script.
I hope that it's useful
Steve
:)
If you use it, remember to change the postfix from 'txt' to 'php'

[attachment deleted by admin]

Re: Jump Menu

Posted: Fri Oct 21, 2005 6:11 pm
by Hans
Hi Steve, thanks for the script. I have a problem however.
This is what I entered in the page:

Code: Select all

{jumpmenu collapse="0" show_root_siblings="1" number_of_levels="3"}

The image shows what I get.
I played a bit with other parameters, but that didn't work.
Did I do something wrong or is there more that should be done?


Thanks Hans


[attachment deleted by admin]

Re: Jump Menu

Posted: Fri Oct 21, 2005 9:06 pm
by steve
hmmm, I'm not sure.

To be honest I'm a bit of PHP newbie so I may not be able to help. I'm off outta town this weekend but I will take a look when I get back.

Have a good weekend

Steve

Re: Jump Menu

Posted: Fri Oct 28, 2005 3:55 pm
by Svenni
Don't forget to attach the Javascript if you want to run it correctly ... but I have a question, too: Where is the best place to place ist?

Re: Jump Menu

Posted: Fri Oct 28, 2005 4:21 pm
by Hans
Thanks so far.... but..
I'm sure its a dumb question but what javascript do I need and where can I find that?
Hans

Re: Jump Menu

Posted: Fri Oct 28, 2005 4:27 pm
by Svenni
Hans wrote: I'm sure its a dumb question but what javascript do I need and where can I find that?
Hans
This:

Code: Select all

<__script__ languange="javascript">
function jumpBox(list) {
  location.href = list.options[list.selectedIndex].value
}
</__script>

Re: Jump Menu

Posted: Fri Oct 28, 2005 4:35 pm
by Svenni
Now I have one more question, too: Is there a way to show only the Pages under the actual site without define start_element? E. g.:

1.1
1.2
2
2.1
2.1.1
2.1.2
2.1.2.1
2.1.2.2
2.1.2.3

Now I'm staying on page 2.1.2 and want only show 2.1.2.1 ... 2.1.2.3 .

Re: Jump Menu

Posted: Fri Oct 28, 2005 4:41 pm
by Hans
Hi Svenni
I don't know where you put the script. I placed it in the header of the template, surrounded by {literal} {/literal}
It works now to the extent that one link brings me to that page, but my problem as mentioned before is still there (see image)
Hans

[EDIT]
OK, I added this in the body of the template, together with the script in the header as mentioned above and so far it works for 1 level.

Code: Select all

{jumpmenu collapse="0" show_root_siblings="1" number_of_levels="2" start_element="1"}
I will see tomorrow what these parameters do (from bulletmenu)

(optional) showadmin - 1/0, whether you want to show or not the admin link.
(optional) collapse - 1/0, whether you want to collapse sub items that shouldn't be shown. Defaults to 0.
(optional) start_element - the hierarchy of your element (ie : 1.2 or 3.5.1 for example). This parameter sets the root node of the menu and only shows it and it's children.
(optional) show_root_siblings - 1/0, if start_element (above) is given, then show direct siblings of the give start_element as well.
(optional) number_of_levels - an integer, the number of levels you want to show in your menu.

Re: Jump Menu

Posted: Fri Oct 28, 2005 6:32 pm
by Piratos
You jumpmenu works fine - but with pimenu very easy:

Here the Template:

Code: Select all

<div>
<form>
<select name="pulldown" onChange="jumpBox(this.form.elements[0])">
<option>---Please select---</option>
{foreach from=$rawmenu item=entry}
{if $entry->url neq ''}
{if $entry->type eq 'separator'}
<option>------</option>
{else}
<option value="{$entry->url}">{$entry->menutext}</option>
{/if}
{/if}
{/foreach}
</select>
</form></div>

Don't forget to set the little Javascript in your Maintemplate

Code: Select all

<__script__ languange="javascript">
function jumpBox(list) {
  location.href = list.options[list.selectedIndex].value
}
</__script>
With Pimenu it was easy 5 Minutes.