Skip to content

paginas_menu_helper_by_cat(catid,options = {})

Carlos Roque edited this page Feb 17, 2015 · 2 revisions

this helper method generates the markup for links to the pages belonging to the category id passed
paginas_menu_helper_by_cat(catid,options = {})

Usage

links = paginas_menu_helper_by_cat 1

This will output the pages contained in category with ID = 1 in the following format

<a href="/preview/1">Page</a> | <a href="/preview/2">Another Page</a>

Available Options

you can also pass an options hash to modify the output.
For example you can do the following

options = {:item_style => '<li class="[active]">[link]</li>',
    :item_separator => "",
    :active_class => 'active',
    :group_style => "<ul>[items]</ul>" }
links = paginas_menu_helper_by_cat 1, options

This will generate

<ul><li class=""><a href="/preview/1">Page</a></li><li class=""><a href="/preview/2">Another Page</a></li></ul>

when visiting 'Page', its class="" will turn to class="active"