I am looking for the procedure for an if/else query for the following task:
If an article page has 1 image uploaded, it should be displayed in the header.
If more than one image is uploaded, a slider should be displayed in the header instead.
With an if/else submission I have to include two different HTML blocks.
This is not a problem, I already have these blocks.
So far, I’ve gone the manual route, but it’s error-prone and requires intervention when the image count changes:
<?php if($page->singleimageorslider() == "true"): ?>
<div> …
My question: How do I create a count()
query in the template for the number of uploaded images?