sunny
1
I am using new blocks feature of kirby 3.5. And I want to nest element .
for example
<li>
<div class="left-number">1</div>
<div class="right-content">
<h3>Fill details</h3>
<p>Fill in your </p>
</div>
</li>
Is there any way to implement it?
You can set up a custom block with a structure field
sunny
3
Please can you share any example of it
There is no particular example, but this button example from the docs:
But as you can see, you are totally free to use any field types Kirby has inside such a block.
There’s also a new recipe that takes you all the steps of building your own custom block types.
Note that you don’t need the build process described there.
sunny
5
I have created simple blocks field and using ‘<?= $page->myBlocksField()->toBlocks() ?>’ this code to render it in template but it is not working.
myBlocksField:
label: Blocks
type: blocks
Also tried with below:
<?php foreach ($page->myBlocksField()->toBlocks() as $block): ?>
<div id="<?= $block->id() ?>" class="block block-type-<?= $block->type() ?>">
<?= $block() ?>
</div>
<?php endforeach ?>
What exactly does that mean? No output? Errors?