Bagaimana cara menyisipkan sebuah elemen pada halaman pages? #282
Answered
by
taufik-nurrohman
yuliakbard
asked this question in
Q&A
-
Misalnya ini hasil loopingan dari $pages: <article></article>
<article></article>
<article></article>
<article></article>
<article></article> ane rencana mau insertkan elemen baru seperti: <article></article>
<!--<article>Elemen Baru</article>-->
<article></article>
<article></article>
<article></article>
<article></article> ataupun mau munculkan tiap <article></article>
<!--<article>Elemen Baru</article>-->
<article></article>
<article></article>
<article></article>
<!--<article>Elemen Baru</article>-->
<article></article> atau <article></article>
<!--<article>Elemen Baru</article>-->
<article></article>
<article></article>
<article></article>
<!--<article>Elemen Baru</article>-->
<article></article>
<article></article>
<article></article>
<!--<article>Elemen Baru</article>-->
<article></article>
<article></article>
<article></article> apa bisa di slice ya kang? |
Beta Was this translation helpful? Give feedback.
Answered by
taufik-nurrohman
Feb 16, 2024
Replies: 1 comment 1 reply
-
Begini kayaknya bisa: <?php $index = 0; foreach ($pages as $page): ?>
<article></article>
<?php if (0 == $index % 3): ?>
<ins class="adsbygoogle"></ins>
<?php endif; ?>
<?php $index += 1; endforeach; ?> |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
yuliakbard
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Begini kayaknya bisa: