How to get page attribute value in 5.7?

Permalink
I'm trying to retrieve a page attribute value that I have added to several pages in concrete 5.7.4.
Previously in 5.6 I would do something like....
<?
    // Load appropriate helpers
    $ih = Loader::helper('image');
    $th = Loader::helper('text');
    // PREPARE CUSTOM IMAGE ATTRIBUTE
    $img = $c->getAttribute('main_image'); // handle of image attribute
    if ($img) {
        $thumb = $ih->getThumbnail($img, 9999, 9999); // ($img, width, height, TRUE) - using 9999 effectively means 'no maximum size' | TRUE = crop instead of resize
    }
    // PREPARE CUSTOM TEXT ATTRIBUTE
    $text = $c->getCollectionAttributeValue('text_attribute');
?>
<div>
    <?php echo $thumb ?>
    <?php echo $text ?>


I'm not sure how to extract the information in the new system. I really want to understand how to do it as opposed to just being given a copy/paste so if there is something I need to go research/learn I would really appreciate being led in that direction :)

Many thanks!

jpcharrier
View Replies: View Best Answer
hutman replied on at Permalink Best Answer Reply
hutman
As you can see from the documentation, the way you get the attributes hasn't changed, but there is a display option now.

http://www.concrete5.org/documentation/developers/5.7/working-with-...

The image helper has changed though, here is an older forum post with lots of information about it.

http://www.concrete5.org/community/forums/5-7-discussion/image-help...
jpcharrier replied on at Permalink Reply
jpcharrier
Thank you!! Some how I had missed that page in the docs, and was looking for the section on attributes (which is coming..) but even a search of the c5 site for "5.7 get attribute value" and similar, never returned that page...

Anyway, thanks again!