Bagaimana Caranya Mendeteksi Laman yang Memiliki Satu Gambar atau Lebih? #183
Answered
by
taufik-nurrohman
yuliakbard
asked this question in
Q&A
Replies: 1 comment
-
<?php if ($images = $page->images): ?>
<?php if (count($images) > 1): ?>
<!-- Images as carousel -->
<?php foreach ($images as $image): ?>
<?= $image; ?>
<br>
<?php endforeach; ?>
<?php else: ?>
<!-- Image as figure -->
<?= reset($images); ?>
<?php endif; ?>
<?php else: ?>
<?php if ($image = $page->image): ?>
<!-- Image as figure -->
<?= $image; ?>
<?php else: ?>
<!-- No image -->
<?php endif; ?>
<?php endif; ?> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
yuliakbard
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
kang, bentuk penulisan kondisional jika sebuah halaman memiliki 1 gambar atau lebih seperti apa kang?
saya pikir bentuknya seperti ini:
ternyata gak bisa. mohon pencerahannya kang.
Beta Was this translation helpful? Give feedback.
All reactions