Forum
Duplicating perch content using a different template
Hello, I have a system where the client upload images to both a gallery and a slideshow. I am trying to install a fallback where if the client doesn't enter any images in the slide show the system will use the images uploaded to the gallery, but with a different template. Code so far is:
<?php
perch_content_create('Artwork Slideshow', array( 'template' => '_artwork/_artwork_slide.html', 'multiple' => true, 'add-to-top' => true, ));
perch_content_create('Artwork Images', array( 'template' => '_artwork/_artwork_image.html', 'multiple' => true, 'add-to-top' => true, ));
$slideshow = perch_content('Artwork Slideshow', true);
$images = perch_content('Artwork Images', true);
$fallback = perch_content_custom('Artwork Images', ['template'=>'_artwork/_artwork_slide.html']);
?>
<div class="imageSlides">
<?php echo ctype_space($slideshow) ? $slideshow : $fallback.'FallBack Invoked'; ?>
</div><!--/.imageSlides-->
Any ideas why it's not working? The fallback is being invoked but no content is being returned.
P.S. - I use 'ctype_space' as 'empty' and '!isset' don't work as the perch system is returning something for regions with an item count of 0.
perch_content_custom()
echoes by default. Passtrue
as the final argument.