Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Quick Jump Menu


Reply


7 Posts   2406 Views

Avatar
filip667

Community Member, 10 Posts

8 July 2010 at 12:41pm

hello , does anyone know how to create the Quick Jump Menu on one particular page?? i'm building the website for the local community centre and they have around 200 groups. rathen then sub-pages i would like to create a "Jump to" menu for each group on the Group page. something similar to this very Forum, where you can select interesting topic (see top right of the page).

i tried to search for the modules or plugins everywhere but found only extensions for Joomla.

im a newby, but a big fan of SS already. any help would be appreciated, especially that i hapilly volounteer to help this community centre have its own editable website :)

cheers ahead!

Avatar
filip667

Community Member, 10 Posts

9 July 2010 at 10:37am

this what im looking but for Silverstripe (not Joomla):
http://extensions.joomla.org/extensions/structure-a-navigation/menu-systems/select-box-menus

some call it "Quick Jums menu" or "Select Box menu".

anybody can recommend such module for silverstripe?? i like this CMS so much, that would be a shame to turn to Joomla because of this. i even thought of modifying and adapting the Forum module but my programming skills are not that strong.

/fil

Avatar
Willr

Forum Moderator, 5513 Posts

9 July 2010 at 11:30am

Edited: 04/08/2010 10:06pm

No module that I know of provides that but you could write a function to do it. Unlike Joomla you will find in SS you will need to write snippets of code. I recommend reading the tutorials. You may not think yourself as a programmer but for your own sanity it helps to pick up some programming knowledge.

To write this you would need to get a list of all the pages on the site (I'll omit grouping like this forum for ease). So create a function in your page_controller in Page.php to return all the pages on your site

function AllPages() {
return DataObject::get('Page');
}

Then in the template you need to build a select and fill it with all pages

<select onchange="if(this.value) location.href = this.value">
<% control AllPages %>
<option value="$Link">$Title</option>
<% end_control %>
</select>

Can put that in any of your templates (eg themes/themename/templates/Page.ss).

Avatar
TotalNet

Community Member, 181 Posts

9 July 2010 at 11:31am

Edited: 09/07/2010 11:34am

You don't need a module, you can use the same code principals in your template directly. It's simply a "select" input with an onchange event.

You can hard-code the links yourself in the template or use a control loop to iterate through the menu links.

It depends on how these "groups" are going to be represented in the CMS. Are they forums, forum topics or simply child pages of a Groups page?

Essentially, how do you expect to manage the links? A drop-down box of 200 items is not very usable.

With a little more detail I can help you out.

Rich

EDIT: beat me to it Willr ;)

Avatar
filip667

Community Member, 10 Posts

4 August 2010 at 9:39pm

Edited: 05/08/2010 8:44pm

Gents, both thank you for reply and sorry for delay - almost missed the notification o my thread!

@Willr - i customised already working code from another website(including the ehader), by changing the <select onchange="if(this.value) location.href = this.value"> as you advised i also changed Page.hph file. i think that <% control AllPages %> causes problems as i get error message: "Parse error: syntax error, unexpected $end in **********.ss.themes.happyorange.templates.Page.ss on line 187".
before the $Link and $Title attributes worked fine but showed only values of the current page.

@TotalNet - the groups are simply child pages of the Groups page. i still keep the Side menu and additionally i will need the QuickJump menu. that makes more sense, as there will be over 200 groups, so instead of scrolling all the way down to "Yoga" you can simply click QuickJump menu and press "Y". i hope that explains the idea.

how can i create the control loop to iterate through the menu links? what's the <select> onchange event value?

<form name="form" id="form">
<select name="jumpMenu" size="1" id="jumpMenu">
<option value="$Link">$Title</option>
<option value="/**i would like all the child pages here*/">/**Yoga group for example*/</option>
</select>
<input type="button" name="go_button" id= "go_button" value="Go" onclick="MM_jumpMenuGo('jumpMenu','parent',0)" />
</form>

EDIT:peace&love

/fil

Avatar
Willr

Forum Moderator, 5513 Posts

4 August 2010 at 10:06pm

@filip667 Yep good fine, my orignal code was missing the <% end_control %> which is required.

Avatar
filip667

Community Member, 10 Posts

5 August 2010 at 8:43pm

cheers @Willr mate, all works fine!! im sure many ss users will benefit from it!

for those who are interested in the menu with the "GO" button here is the complete code:
<form class="right" name="form" id="form">
<select name="jumpMenu" id="jumpMenu">
<% control AllPages %>
<option value="$Link">$Title</option>
<% end_control %>
</select>
<input type="button" name="go_button" id= "go_button" value="Go" onclick="MM_jumpMenuGo('jumpMenu','parent',0)" />
</form>

it is always set by default to the first child page regardless of where you go - which is a bit annoying. if someone knows how to set as default the Jump to:"Select" field or blank field, please let me know. i guess some kind of <if> loop may be needed within <option value="">Select</option>.
@TotalNet any advice??

/fil