Get Page Attribute Value Displayed in Autonav

Permalink
Hello,

I've created a new template (blocks/autonav/templates) and I want a page attribute displayed within the autonav.

echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . '<div class="icon-' . $c->getAttribute('page_icon') . '"   ></div>' . $ni->name . '</a>';


I want before $ni->name display the value from the page attribute called 'page_icon' so that each currently vied page has his own 'page_icon'.

Error I'm getting is this:
Fatal error: Call to a member function getAttribute() on a non-object in E:\SERVER-BACKUP\EasyPHP5.2.10\www\osv3\c5\blocks\autonav\templates\view.php on line 119

1 Attachment

primewaydesign
 
pvernaglia replied on at Permalink Reply
pvernaglia
try $ni->getAttribute('page_icon')
primewaydesign replied on at Permalink Reply 1 Attachment
primewaydesign
Hi pvernaglia,

thank you for your reply.

Unfortunately the $ni->getAttribute('page_icon') does not work, still same issue.

Though I have managed to get some unwanted results with this:
$this->page_icon = Page::getCurrentPage()->getCollectionAttributeValue('page_icon');
...
...
...
echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . '<i class="icon-' . $this->page_icon . '"></i> ' . $ni->name . '</a>';


this repeats the same value attribute to all navigation items like the nav-selected one (see attachment).

please help me out.
primewaydesign replied on at Permalink Reply
primewaydesign
No one can help with this?

Any solution or hint are welcome!
mtemple replied on at Permalink Reply
What you are looking for is:

$ni->cObj->getAttribute('page_icon');