Forum
Using content from Repeaters on other pages
Hi There
I'm not sure if this has been covered... I've had a search but couldn't find anything that fitted.
I have a template with a content area at the top and a repeater containing a short and simple series of images (a cut down gallery)
What I want to do is use the first four images from this repeater on the overview page of the product group.
I can bring in the whole of the content region using perch_content_custom but when I try to format using a template to just bring out the images, nothing comes through.
I'm using the following code to bring in the images
<div id="short-gallery">
<ul>
<?php
perch_content_custom('gallery-content', array(
'page'=>'/products/full-colour-cards/gallery.php',
'template'=>'gallery-insert.html',
'count'=>3,
));
?>
</ul>
</div>
And this is the template I'm wanting to use to with this code
<li><img src="<perch:content type="image" id="gallery-image" crop="true" width="200" height="200"/>"></li>
And here is the original template with the repeater I want to pull the content from.
<perch:content id="gallery-intro" type="textarea" label="Gallery Intro" textile="true" editor="markitup" required="true" />
<perch:repeater id="gallery-images" label="Gallery Images">
<img src="<perch:content type="image" id="gallery-image" label="Gallery Image" crop="true"/>" style="margin-left: -280px;"/>
</perch:repeater>
<perch:content type="image" id="gallery-image" label="Gallery Image" crop="true" suppress="true" width="200" height="200"/>
Use the perch:repeater tag too.
Noticed you're using count on your perch_content_custom, if you want only 3 items to be returned from the repeater you'll need to add max="3" onto the repeater tag in your template instead. Count is for multi item regions.
Wow... thanks Dexter, you've nailed it. Many thanks.
The images I want now display where I want them!.
Cheers
Wonder if I might pick your brains once more Dexter?
I'd hoped to use a different sized version of the images in the repeater, which I'd listed at the bottom of my template with a suppress="true" at 200px x 200px cropped.
I'm getting the original images pulled through at the original size and the secondary cropped image is ignored (if it's even been processed in the first place)
Is there a way to do this that you've found?
In the main template try it like this.
(Put the secondary image within the repeater tag).
Cheers Dexter... didn't work, I'm short on time, so I'll have to do something else to get done what I need and maybe look at this again another time.
Thanks for helping though, so nearly there.