Hi, I am trying to change a website I made without using Kirby to Kirby.
This is a single page website, and I need to increase number next to the every class name and id.
and I want to load every page without using like “<?php if ($work01 = page('the-space-between-us')): ?>”…
how can use foreach tag in this code…?
<?php snippet('header') ?>
<?php
for ($i = 0; $i < 1; $i++) {
?>
<?php if ($work01 = page('the-space-between-us')): ?>
<div class="slideshow">
<div class="slideshow-box">
<div class="slideshow-holder">
<?php foreach ($work01->images() as $workimage): ?>
<div class="slide">
<?= $workimage ?><br><br>
</div>
<?php endforeach ?>
</div>
<div class="tooltip">
<p id="myText<?php printf("%02d\n", $i)?>"><?= $work01->worktitle() ?></p>
</div>
<div class="toolbox" id="myDIV<?php printf("%02d\n", $i)?>">
<?= $work01->description() ?>
</div>
</div>
<div class="actions">
<span>1/3</span>
</div>
<a href="#" class="prev">←</a>
<a href="#" class="next">→</a>
</div>
<?php endif ?>
<script>
var button<?php printf("%02d\n", $i)?> = document.getElementById('myText<?php printf("%02d\n", $i)?>');
var div<?php printf("%02d\n", $i)?> = document.getElementById('myDIV<?php printf("%02d\n", $i)?>');
div<?php printf("%02d\n", $i)?>.style.display = 'none';
button<?php printf("%02d\n", $i)?>.onclick = function () {
if (div<?php printf("%02d\n", $i)?>.style.display !== 'none') {
div<?php printf("%02d\n", $i)?>.style.display = 'none';
} else {
div<?php printf("%02d\n", $i)?>.style.display = 'block';
}
};
</script>
<?php
}
?>
<?php snippet('footer') ?>
thank you very much…!