Post thumbnails for page lists
Permalink
I have created a block with the Page List block, and have it show a list of the five latest pages of a specific page type.
There is a summary of the text for each, but I would also like to have an image that was uploaded as an attribute to be shown as a thumbnail for each page. Essentially like a newspaper-layout, with an image for each article listed.
Preferably also resized to fit. Is there a function in Concrete5 that allows automatic resizing?
Also, how can I put a "read more" text or graphic at the end of each summary?
Thanks for any pointers that you can help me with;)
There is a summary of the text for each, but I would also like to have an image that was uploaded as an attribute to be shown as a thumbnail for each page. Essentially like a newspaper-layout, with an image for each article listed.
Preferably also resized to fit. Is there a function in Concrete5 that allows automatic resizing?
Also, how can I put a "read more" text or graphic at the end of each summary?
Thanks for any pointers that you can help me with;)
Copy this file
concrete/blocks/page_list/templates/custom.php
TO
blocks/page_list/templates/custom.php
(you can name this page anything in this format 'my_page_list_template'). And never alter anything in the concrete folder itself. This way you are not altering the core.
Now you can alter this file
concrete/blocks/page_list/templates/custom.php
TO
blocks/page_list/templates/custom.php
(you can name this page anything in this format 'my_page_list_template'). And never alter anything in the concrete folder itself. This way you are not altering the core.
Now you can alter this file
<?php for ($i = 0; $i < count($cArray); $i++ ) { $cobj = $cArray[$i]; $title = $cobj->getCollectionName(); //get the attached image based on attribute $lfb = LibraryFileBlockController::getFile($cobj->getAttribute('thumbnail_image')->fID); $thumbnail = $lfb->getThumbnail(65,65)->src; ?> <img src="<?php echo $thumbnail?>" align="left" /> <h3 class="ccm-page-list-title"><a href="<?php echo $nh->getLinkToCollection($cobj)?>"><?php echo $title?></a></h3> <p><?php echo $cobj->getCollectionDescription() ; ?><br /> <a href="<?php echo $nh->getLinkToCollection($cobj)?>">Read More</a> <?php } ?>
Thanks to both of you. Very helpful answers. I understand it a lot better now. Template override.
http://www.concrete5.org/community/forums/customizing_c5/modify_pag...
remo has a tutorial about adding images to page-list block:
http://www.codeblog.ch/category/concrete5/...