How to add page handle as class name in Auto Nav?

Permalink 1 user found helpful
I'd like to have page handle as a class name in Autonav <li>'s. This may be very easy to do but I'm unable to figure this out.

The code below is from view.php from Autonav block. In the code below I've used $ni->getName() as class name but I want something like $ni->getHandle() - but this is not part of AutonavBlockItem.

Another alternative I can think of is to explode $ni->getURL() and get the last part of the url but I was wondering if there is a cleaner way to do this.

echo('<li class="'.$ni->getName().'"><a href="' . $pageLink . '" ' . $target . ' >' . $ni->getName() . '</a>');

BlueFractals
 
ScottSandbakken replied on at Permalink Reply
ScottSandbakken
To get the handle of a page:

$handle = $page->getCollectionHandle();


Inside of an autonav block, I believe it would be...

$handle = $ni->cObj->getCollectionHandle();
BlueFractals replied on at Permalink Reply
BlueFractals
It's giving me fatal error:

Fatal error: Call to a member function getCollectionHandle()on a non-object in C:\Program Files\xampp1.7.7\htdocs\test\blocks\autonav\templates\header_menu_dropdown.php on line 72
ScottSandbakken replied on at Permalink Reply
ScottSandbakken
It works in 5.6.0.2.

What version of Concrete5 are you using?
BlueFractals replied on at Permalink Best Answer Reply
BlueFractals
I am using the same version.

Anyway I've figured it out. I had to use $_c->getCollectionHandle() inside autonav block template.

echo('<li class="'.$_c->getCollectionHandle().'"><a href="' . $pageLink . '" ' . $target . ' >' . $ni->getName() . '</a>');