leider funktioniert es nicht, wenn TOP News ausgewält sind, dass diese auch an der ersten stelle bleiben.
<?php $articles = $this->get('articles'); $adminAccess = null; if ($this->getUser()) { $adminAccess = $this->getUser()->isAdmin(); } ?> <?php $article_count = count($articles); if(count($articles) > 0) { for ($i = 0; $i < $article_count; $i++) { $article = $articles[$i]; $date = new \Ilch\Date($article->getDateCreated()); $title = $this->escape($article->getTitle()); $author = $this->escape($article->getAuthorName()); $author_url = $this->getUrl(['module' => 'user', 'controller' => 'profil', 'action' => 'index', 'user' => $article->getAuthorId()]); $date_formatted = $date->format('d.', true) . " " . $this->getTrans($date->format('F', true)) . " " . $date->format('Y', true); $content = $article->getContent(); $content = substr($content, 0, 100); $img = $this->getBaseUrl($article->getImage()); $imgSource = $this->getBaseUrl($article->getImageSource()); if(!empty($img)) { $imgURL = $img; } else { $imgURL = $imgSource; } if ($i == 0) { //Großes echo "<div class='col-lg-6'> <div class='NewsBoxes'> <div class='imgDesc'> <img class='img' src='$imgURL'> <div class='dateCat'> <div class='btnN'>$date_formatted</div> <div class='btnN'><a class='newsbutton-lg' style='color: black;' href='{$this->getUrl(['module' => 'user', 'controller' => 'profil', 'action' => 'index', 'user' => $article->getAuthorId()])}' target='_blank'>$author</a></div> </div> <div class='desc'> <div class='inner'> <h3>$title</h3> <a class='newsbutton-lg' href='{$this->getUrl(['module' => 'article', 'controller' => 'index', 'action' => 'show', 'id' => $article->getId()])}' target='_blank'>Read More</a> </div> </div> </div> </div> </div> <div class='col-lg-6 order-0 order-lg-2'> <div class='row'> <div class='col'> <div class='newsSmall'>"; } else if($i < 4) { //Drei kleine echo "<a href='{$this->getUrl(['module' => 'article', 'controller' => 'index', 'action' => 'show', 'id' => $article->getId()])}'> <div class='object boxes mgb'> <img class='img' src='$imgURL'> <div class='pad'> <div class='row'> <div class='col-md-2 col-xs-3'> <img class='newsImgSmallN2' src='$imgURL'> </div> <div class='col-md-10 col-xs-9'> <div class='smallcat'> <div class='btnsN'>$date_formatted</div> </div> <a href='{$this->getUrl(['module' => 'article', 'controller' => 'index', 'action' => 'show', 'id' => $article->getId()])}'><h3>$title</h3></a> </div> </div> </div> </div> </a>"; } } echo "</div> </div> </div> </div>"; } else { echo $this->getTrans('noArticles'); } ?>
verwendete ilch Version: 2.1.x
betroffene Homepage: localhost