Hab einen read more code geschrieben und bin mir unsicher, wo ich ich in in der article index.php einbauen soll ?
mein code
1 2 3 | $strCut =substr($desc,0,150); $desc =substr($strCut,0,strrpos($strCut,' ')).' Read more'; echo $content = $article->getContent(); |
index.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?php if ( $article ->getTeaser()): ?> <h3><?= $this ->escape( $article ->getTeaser()) ?></h3> <?php endif ; ?> <h2><a href= "<?=$this->getUrl(['action' => 'show', 'id' => $article->getId()]) ?>" ><?= $this ->escape( $article ->getTitle()) ?></a></h2> <?php if (! empty ( $image )): ?> <figure> <img class = "article_image" src= "<?=$this->getBaseUrl($image) ?>" > <?php if (! empty ( $imageSource )): ?> <figcaption class = "article_image_source" ><?= $this ->getTrans( 'imageSource' ) ?>: <?= $this ->escape( $imageSource ) ?></figcaption> <?php endif ; ?> </figure> <?php endif ; ?> <?php $content = $article ->getContent(); ?> <?php if ( strpos ( $content , '[PREVIEWSTOP]' ) !== false): ?> <?php $contentParts = explode ( '[PREVIEWSTOP]' , $content ); ?> <?=reset( $contentParts ) ?> <br /> <a href= "<?=$this->getUrl(['action' => 'show', 'id' => $article->getId()]) ?>" class = "pull-right" ><?= $this ->getTrans( 'readMore' ) ?></a> <?php else : ?> <?= $content ?> <?php endif ; ?> <hr /> |
muss der code in zeile 14 eingebaut werden ?
verwendete ilch Version: 2.x