Custom attribute

Permalink Browser Info Environment

I'd like to add an image to the menu, which is a custom attribute 'thumb' of each page. I'v tried several things, but I can't get it in the foreach loop. Any ideas?

Big thnx!

-- edit ! --

Nevermind, I found it! See code below if you're interested!

in controller.php:
function view() {
 $nh = Loader::helper('navigation');
 $ih = Loader::helper('image');
 $linkRows = $this->getLinks();
 $linkObjs = array();
 foreach ($linkRows as $row) {
  $page = Page::getByID($row['linkToCID']);
  $link = new stdClass;
  $link->url = $nh->getLinkToCollection($page);
  $link->text = $row['linkText'];
  $link->cID = $row['linkToCID'];
  $link->cPath = $page->getCollectionPath();
  // get some page attributes
  $img = $page->getAttribute('thumbnail'); // thumbnail is a page attribute image
  $thumb = $ih->getThumbnail($img, 244, 9999, false); // i always want the same width

foreach list item in in view.php:
<?php  foreach ($links as $link):
 $thumb = $link->myThumbnail->src; // thumbnail
 $cssClasses = array();
 if ($currentCID == $link->cID) {
  $cssClasses[] = 'nav-selected';
 if (strpos($currentCPath, $link->cPath) === 0) {
  $cssClasses[] = 'nav-path-selected';
 $cssClasses = implode(' ', $cssClasses);
<li class="<?php  echo $cssClasses; ?>">
 <h3><a href="<?php  echo $link->url; ?>" class="<?php  echo $cssClasses; ?>"><?php  echo htmlentities($link->text, ENT_QUOTES, APP_CHARSET); ?></a></h3>
 <a href="<?php  echo $link->url; ?>"><img src="<?php  echo $thumb; ?>" width="<?php  echo $link->myThumbnail->width ?>" height="<?php  echo $link->myThumbnail->height ?>" alt="<?php  echo htmlentities($link->text, ENT_QUOTES, APP_CHARSET); ?>" border="0" /></a>
 <p><?php  echo htmlentities($link->myDescription, ENT_QUOTES, APP_CHARSET); ?></p>

Type: Discussion
Status: New
View Replies:

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.