Problem with cover on the menu

Hi !
I have a problem with the cover in the menu. the images doesn’t show and there are in the panel menu.
Please help me, where is the code to show the images ?


quote=“delphine_bellante, post:1, topic:27463”]
Please help me, where is the code to show the images ?
[/quote]

Sorry, how are we supposed to know where your code is? Please post the code you are using to render those images?

There is either a problem with how you render the images or there is a problem with thumbs generation.

Sorry, how are we supposed to know where your code is? Please post the code you are using to render those images?
[/quote]

Yes, i’m sorry, I’m learning this new language.
**I was started with the demo’s kirby code **
blueprints → sections

type: pages
headline: BSR
parent: kirby.page(“bsr”)
size: small
info: “{{ page.images.count }} image(s)”
layout: cards
template: casalina-template
empty: Pas de page du BSR

I guess you mean the Starterkit? (Because there is also a Demo repo, so just to verify).

yes, it’s the starterkit.
I think I have a problem on the template’s code :

<?php
/*
  Templates render the content of your pages.

  They contain the markup together with some control structures
  like loops or if-statements. The `$page` variable always
  refers to the currently active page.

  To fetch the content from each field we call the field name as a
  method on the `$page` object, e.g. `$page->title()`.

  This home template renders content from others pages, the children of
  the `photography` page to display a nice gallery grid.

  Snippets like the header and footer contain markup used in
  multiple templates. They also help to keep templates clean.

  More about templates: https://getkirby.com/docs/guide/templates/basics
*/
?>
<?php snippet('header') ?>
  <?php snippet('intro') ?>
  <?php
  /*
    We always use an if-statement to check if a page exists to
    prevent errors in case the page was deleted or renamed before
    we call a method like `children()` in this case
  
=> page('casalina') récupère les (enfants) articles dans le pannel correspondant  */
  ?>
  
    <h1> CASALINA </h1>
    
  <?php if ($casalinaPage = page('casalina')): ?> 
  <ul class="home-grid">
    <?php foreach ($casalinaPage->children()->listed() as $casalina): ?>
    <li>
      <a href="<?= $casalina->url() ?>">
        <figure>

          <?php if ($cover = $casalina->cover()): ?>
          <?= $cover->resize(20, 20) ?>
          <?php endif ?>
          <figcaption>
            <span>
              <span class="example-name"><?= $casalina->title()->html() ?></span>
            </span>
          </figcaption>
        </figure>
      </a>
    </li>
    <?php endforeach ?>
  </ul>
  <?php endif ?>
  
   <h1> BSR </h1>
  
    <?php if ($bsrPage = page('bsr')): ?>
  <ul class="home-grid">
    <?php foreach ($bsrPage->children()->listed() as $bsr): ?>
    <li>
      <a href="<?= $bsr->url() ?>">
        <figure>
          <?php
          /*
            The `cover()` method defined in the `album.php`
            page model can be used everywhere across the site
            for this type of page

            We can automatically resize images to a useful
            size with Kirby's built-in image manipulation API
          */
          ?>
          <?php if ($cover = $bsr->cover()): ?>
          <?= $cover->resize(200, 200) ?>
          <?php endif ?>
          <figcaption>
            <span>
              <span class="example-name"><?= $bsr->title()->html() ?></span>
            </span>
          </figcaption>
        </figure>
      </a>
    </li>
    <?php endforeach ?>
  </ul>
  <?php endif ?>
  
  
<?php snippet('footer') ?>

Or maybe here :

<?php
/*
  Snippets are a great way to store code snippets for reuse
  or to keep your templates clean.

  This gallery snippet is used in the gallery plugin (`/site/plugins/gallery`)

  More about snippets:
  https://getkirby.com/docs/guide/templates/snippets
*/
?>
<section class="gallery">
  <?php foreach ($gallery->images() as $image): ?>
  <figure>
    <a href="<?= $image->link()->or($image->url()) ?>">
      <?= $image->crop(50, 100) ?>
    </a>
  </figure>
  <?php endforeach ?>
</section>

Thank you so much, I don’t understand

Ok, so you are editing the home.php template…

However, it’s hard to tell what’s going wrong without knowing about all the other changes you made. Do the subpages of the casalina page, i.e. those with the casalina-template have a cover field?

yes,this is the code template/casalina.php

<?php snippet('header') ?>

<?php if (empty($tag) === false): ?>
<header class="h1">
  <h1>
    <small>Tag:</small> <?= html($tag) ?>
    <a href="<?= $page->url() ?>">&times;</a>
  </h1>
</header>
<?php else: ?>
  <?php snippet('intro') ?>
<?php endif ?>

<ul class="grid">
  <?php foreach ($casalina as $note): ?>
  <li class="column" style="--columns: 4">
      <?php snippet('note', ['note' => $note]) ?>
  </li>
  <?php endforeach ?>
</ul>

<?php snippet('pagination', ['pagination' => $casalina->pagination()]) ?>
<?php snippet('footer') ?>

and snippets/note.php

<article class="note-excerpt">
  <a href="<?= $note->url() ?>">
    <header>
      <figure class="img" style="--w: 16; --h:9">
        <?php if ($cover = $note->cover()): ?>
        <?= $cover->crop(320, 180) ?>
        <?php endif ?>
      </figure>

      <h2 class="note-excerpt-title"><?= $note->title() ?></h2>
      <time class="note-excerpt-date" datetime="<?= $note->published('c') ?>"><?= $note->published() ?></time>
    </header>
    <?php if (($excerpt ?? true) !== false): ?>
    <div class="note-excerpt-text">
      <?= $note->text()->toBlocks()->excerpt(280) ?>
    </div>
    <?php endif ?>
  </a>
</article>

I’m a bit confused, because this is a different template than the one you posted above.

To cut this short, could you please upload your a zip of your current state somewhere and send me a link via PM?

Hi,

I send you a PM with my folder.

Thanks for your help.