It seems that toStructure() can’t handle multiline data, so what’s the best solution to overcome this issue?
At the moment I have something like this:
<?php foreach($page->overview()->toStructure() as $overview): ?>
<h3><?php echo $overview->heading() ?></h3>
<?php echo $overview->text()->kirbytext() ?>
<?php endforeach ?>
And the page looks like this
- heading: first header
text: some text, which should be multiline data.
- heading: 2nd header
text: but in some of these I NEED tables...!
Do you have a better idea? What did I miss here?
You can do it like this:
bla blablab akdjajf daj jdjf jfjd fjdj jfdj
Thank you very much, texnixe.
This works great. But I still need tables in some of them. Having the code directly in the .txt doesn’t work like anyplace else.
What is the smartest way for this?
That’s strange. Are you using
kirbytext() to output the content?
Yes. It looks very funny, because then everything gets collapsed into the first
Have you made sure that your indentation is correct?
bla bla bla
| 1 | 2 | 3 | 4 | 5 |
| 1 | 2 | 4 | 6 | 7 |
| 1 | 3 | 4 | 5 | 6 |
| 1 | 3 | 5 | 7 | 8 |
bla bla bla bla blub
I took a html table…
well well, this topic is solved.
HTML tables should work as well …
BTW.: If you want to use markdown table syntax, the
markdown.extra option needs to be enabled in your config.php.
Your table is working, the HTML table wasn’t.
Bug or some other stuff going on?
I put an HTML table in and it worked, so not sure this is a bug. I’ve put this into a file:
bla bla bla
some more text here ...
Ok, it works. It is just VERY picky with the correct intendation.
Yep, the YAML syntax is very strict about relative indentation.
If you use the structure field, you don’t have to care about that stuff though as Kirby will indent it properly for you.