Get thubnail Attribute
Permalink 1 user found helpful
I will like to customize the default search block so i can have the result query with that page's thumbnail, that is a image custom attribute
I get:
Fatal error: Call to undefined method IndexedSearchResult::getAttribute()
I can get the ID for the result ( using $r->getID() )... but haven't worked out how to get the attribute for the result... I'm trying to get a list of tags for each result displayed.
Any suggestions? (php experience = 1 week)
Fatal error: Call to undefined method IndexedSearchResult::getAttribute()
I can get the ID for the result ( using $r->getID() )... but haven't worked out how to get the attribute for the result... I'm trying to get a list of tags for each result displayed.
Any suggestions? (php experience = 1 week)
found a bit of code here:
http://wiki.razrlight.com/concrete5_cheatsheet...
and modified it to this:
so far so good... next step - getting tags to display...
http://wiki.razrlight.com/concrete5_cheatsheet...
and modified it to this:
<?php $ih = Loader::helper('image'); $oPage = Page::getById($r->getID()); //the ID of current result $sTitle = $oPage->getCollectionName(); if($oThumb = $oPage->getAttribute('page_thumbnail')); //execute the following code if the thumbnail exists ?> <img src="<?php echo $ih->getThumbnail($oThumb, 100, 100)->src ?>" alt="<?php echo $title ?>" />
so far so good... next step - getting tags to display...
The in the view file of the search block you can reference the image like this: