How to display attribute value in search results

Permalink
How do I echo a page's custom attribute in the search block's view.php file?

$job_ref_value = $c->getCollectionAttributeValue('job_ref');


This is the sort of thing I want to echo, but I don't know the syntax to get the attribute. I guess it will be along these lines:

$job_ref_value = $r->getAttribute('job_ref');


but that doesn't work... Also, doing this works fine for a page list:

$job_ref_value = $cobj->getAttribute('job_ref');


But how can I get this to work for the search results?

 
MathiasB replied on at Permalink Reply
MathiasB
I have the same problem.
The custom attributes can be displayed in the page-list but not in the search results.
I have many pages with "page-thumbnails" and also many pages with a custom attribute "coverlink" (which is a complete link to a extern pic).
But I am not able to get the coverlink-attribute value into my search results view.php to display the external pic instead of a "page_thumbnail".

I guess it is not possible to use custom attributes in search results.
bbeng89 replied on at Permalink Reply
bbeng89
Hi crstf,

Check out my answer to MathiasB's problem here:http://www.concrete5.org/community/forums/usage/how-to-display-cust...

Hopefully that will help you out.