Hi,
I hope someone can help me or point me in the right direction on how to build a bootstrap carousel slider with thumbnails using KIRBY tags. I am not a pro with Kirby tage or PHP but I have the structure ready but I am not sure how to structure it with Kirby tage. When you select the thumbnail the image display.
Not sure I understand. Do you want to create a custom Kirbytag that users can insert into their textarea? r do you want to create such a carousel from a set of files from a files field or section?
You need to loop through your collection of images and then output the relevant html.
The basic structure is always like this:
<!-- start outer HTML wrapper -->
<?php
$images = $page->images()->template('whatever'); // or whatever you want to filter your images by
foreach ( $images as $image ) : ?>
<!-- html for the single slide -->
<?php endforeach ?>
<-- end outer HTML wrapper -->
Of course, you have to fill this with the particular HTML required by Bootstrap. I cannot copy code from an image. If you still have problems, paste the HTML here.
And a second loop for the controls, only this time, you use use Kirby thumb feature to create the thumbnails.
Hi, Sorry to bother you again but the basic structure you provided seems to not work. I believed I am doing something wrong. So I pasta two version, one with Kirby Markup and the second one with only html.
I’m trying to adapt the code for a tab-navigation … and I am struggling with my humble php-knowledge …
The first button in the list should also have an “active”-class for the css and with my code i am getting the following error: “Call to a member function is() on array”. Can anybody can give me a hint?
Without <?= $tab->is($tabs->first()) ? ' active' : '' ?> the code is working.
When you use yaml() wiht a structure field, you get an array and each item in that array is again an array. To be able to use a class method like is() or later first(), you need objects, though.