I have this foreach loop:
<?php foreach(page('archive')->children() as $article): ?>
Since I tried to import the url into the youtube helper:
<?= youtube($article->videourl(), [], ["class" => "article-preview-video") ?>
it gives me this error:
I have this foreach loop:
<?php foreach(page('archive')->children() as $article): ?>
Since I tried to import the url into the youtube helper:
<?= youtube($article->videourl(), [], ["class" => "article-preview-video") ?>
it gives me this error:
Can you enable debug mode?
ParseError thrown with message “Unclosed ‘[’ does not match ‘)’”
Stacktrace:
#7 ParseError in C:\xampp\htdocs\bramschelebtkirche\site\templates\home.php:104
#6 Kirby\Toolkit\F:loadIsolated in C:\xampp\htdocs\bramschelebtkirche\kirby\src\Toolkit\F.php:379
#5 Kirby\Toolkit\F:load in C:\xampp\htdocs\bramschelebtkirche\kirby\src\Toolkit\Tpl.php:35
#4 Kirby\Toolkit\Tpl:load in C:\xampp\htdocs\bramschelebtkirche\kirby\src\Cms\Template.php:167
#3 Kirby\Cms\Template:render in C:\xampp\htdocs\bramschelebtkirche\kirby\src\Cms\Page.php:1172
#2 Kirby\Cms\Page:render in C:\xampp\htdocs\bramschelebtkirche\kirby\src\Cms\App.php:687
#1 Kirby\Cms\App:io in C:\xampp\htdocs\bramschelebtkirche\kirby\src\Cms\App.php:1040
#0 Kirby\Cms\App:render in C:\xampp\htdocs\bramschelebtkirche\index.php:5
Ok i failed at the code. Lost one ]:
I fixed that, but now debugger shows:
Invalid YouTube source
Should be
<?= youtube($article->videourl(), [], ["class" => "article-preview-video"]) ?>
Can you please post output of <?= var_dump($article->videourl()->value()) ?>
here?
HTML::youtube()
expects a link from the youtube.com
domain. Double check on that.
Oh ok i deleted the link for testing. Now its working but these videourl thing is only optional. How can i make it optional?
<?php if($article->videourl()->isNotEmpty()) {
echo youtube($article->videourl(), [], ["class" => "article-preview-video"]);
} ?>
Maybe its a good idea to read through the cookbooks and docs a bit?
Ok wow now i remember. I already read the article in the references yesterday, but had no idea how important this function is…
Thank you so much!