opalepatrick Posted August 17, 2014 Share Posted August 17, 2014 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. Link to comment Share on other sites More sharing options...
Soma Posted August 17, 2014 Share Posted August 17, 2014 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); 2 Link to comment Share on other sites More sharing options...
opalepatrick Posted August 18, 2014 Author Share Posted August 18, 2014 Thanks a lot Soma, once again a rescuer Link to comment Share on other sites More sharing options...
opalepatrick Posted August 18, 2014 Author Share Posted August 18, 2014 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. Link to comment Share on other sites More sharing options...
Soma Posted August 18, 2014 Share Posted August 18, 2014 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". Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now