my idea is:
At the start of site , If no image has been embed, the page begins with the next section (eg page title and the paragraph).
how can i do this with a loop ?
my idea is:
At the start of site , If no image has been embed, the page begins with the next section (eg page title and the paragraph).
how can i do this with a loop ?
Could you please post the code inside a Markdown code block (three backticks) instead of posting a screenshot so that we can directly add the required changes to your code and don’t have to manually type the code?
You don’t need a loop, you need an if-statement:
<?php
if($page->bild()->isNotEmpty()): ?>
<section> ... </section>
<?php endif ?>
<?php snippet('header', array ('id' => 'about-page' , 'class' => 'article-page')) ?>
<div id="main">
<section id="article-header" style="background-image:url(<?php echo $page->image($page->bild())->url() ?>);" data-bg-srcset="/img/about-header-bg-800.jpg;;/img/about-header-bg-1500.jpg;;/img/about-header-bg-2500.jpg">
</section>
<section class="module-text-content primary-bg-color">
<h3><?php echo $page->ueberschrift1() ?></h3>
<p><?php echo $page->Textabsatz()->kirbytext() ?></p>
</section>
Thanks. I have edited your post so that it supports syntax highlighting. You can see how that works if you click on the edit (pencil) button under your post. As I wrote: Three backticks.
@texnixe already posted a solution above. You need to wrap the if statement around the section with the image.
i have added the if-statement around my image section …like u said
<?php
if($page->bild()->isNotEmpty() : ?>
<section id="article-header" style="background-image:url(<?php echo $page->image($page->bild())->url() ?>);" data-bg-srcset="/img/about-header-bg-800.jpg;;/img/about-header-bg-1500.jpg;;/img/about-header-bg-2500.jpg">
</section>
<?php endif ?>
after this, i open my site and it gives me a Parse error in line 6 … line 6 is where the if-statement starts
Oops, sorry, stupid mistake, I forgot to close the brackets:
if($page->bild()->isNotEmpty()): ?>
yeeah thank u for the solution and for answering really fast