Jump to content

Recommended Posts

Posted

I am trying to work out how to add a string to the list tpl in MarkupSimpleNavigation so that I get something like

<li data-magellan-arrival="about">

I could add it to list_tpl 

<li data-magellan-arrival="{title}"> 

but unfortunately {title} is not interpreted as in the href

Any ideas? Appreciated.

Posted

There's no real support for placeholder parsing in the list_tpl, only on the item_tpl.

The list_tpl has the %s that will get replaced with a class="..." string. There's a hookable method that is only for the css class string to hook into and add custom classes. So it's practically possible to use that with a little trick to add a string and would look like this:

$menu = $modules->MarkupSimpleNavigation;

$menu->addHookAfter("getListClass", null, function($event){
    $class = $event->arguments("class");
    $child = $event->arguments("page");
    $event->return = $class . '" data-attr="' . $child->title; // closing " will get added later
});

echo $menu->render($options);
  • Like 2
Posted

Just  a quick follow up Soma. The current_class seems to have stopped working after utilising the above? Mind you, as I am doing a one page design, I need to figure out 'active' in relation to links on the same page anyway.

Posted

No, "current" class on lists works as usual.

For one page websites, this of course doesn't work, cause you're not on a page it could make "current".

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...