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....
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!
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 ?>
Viewing 15 lines of 16 lines. View entire code block.
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!
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...