The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Exclude current page article from list?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #175552

    So I can’t wrap my head around this logic at the moment. I’m trying to exclude data depending on the page I am viewing.

    For example (see screenshot)

    Read the title of the article. Now, look at the subfooter of the list of receding articles. How can I get rid of article I am currently viewing (see 6)?

    I want this functionality to be the same no matter what article I’m viewing. For instance, if I am viewing Kirby Comments, I don’t want that to show up in the subfooter.

    To get the last article’s content on the homepage, this is my code:

    <?php $article = $pages->find('column')->children()->visible()->last(); ?>
            <?php echo markdown($article->textarea()); ?>

    For the subfooter, I am doing this:

        $articles = $page->children()->visible()->flip()->paginate(3);
        foreach($articles as $article): 
     <article class="article">
         <span class="numeral"><?php echo ltrim($article->num(), '0'); ?></span>
         <span><a href="<?php echo html($article->url()) ?>"><?php echo html($article->title()) ?></a></span>
        <time pubdate="pubdate"><?php echo $article->date('n·j·Y') ?></time>
    <?php endforeach; ?>

    I hope this makes sense. I also posted the problem over at the Kirby Forum.

Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.