forked from ZwiiCMS-Team/ZwiiCMS
ok
This commit is contained in:
parent
73cfc61823
commit
0afbaf81ea
@ -62,9 +62,9 @@ class news extends common {
|
||||
|
||||
public static $height = [
|
||||
200 => 'Petite',
|
||||
400 => 'Moyenne',
|
||||
600 => 'Grande',
|
||||
1000 => 'Article complet'
|
||||
600 => 'Moyenne',
|
||||
1200 => 'Grande',
|
||||
-1 => 'Article complet'
|
||||
];
|
||||
|
||||
// Signature de l'article
|
||||
@ -427,9 +427,13 @@ class news extends common {
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
self::$news[$newsIds[$i]] = $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i]]);
|
||||
// Longueur de la news affichée
|
||||
if ($this->getData(['module', $this->getUrl(0), 'config', 'height']) !== 1000) {
|
||||
self::$news[$newsIds[$i]]['content'] = substr($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'content']), 0,
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'height'])) ;
|
||||
if ( $this->getData(['module', $this->getUrl(0), 'config', 'height']) !== -1
|
||||
&& strlen($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'content'])) >= $this->getData(['module', $this->getUrl(0), 'config', 'height']) ) {
|
||||
// Contenu raccourci
|
||||
$content = substr($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'content']), 0, $this->getData(['module', $this->getUrl(0), 'config', 'height']));
|
||||
// Ne pas couper un mot
|
||||
$lastSpace = strrpos($content, ' ', -1 );
|
||||
self::$news[$newsIds[$i]]['content'] = substr($content, 0, $lastSpace) ;
|
||||
}
|
||||
// Mise en forme de la signature
|
||||
self::$news[$newsIds[$i]]['userId'] = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'userId']));
|
||||
|
@ -7,7 +7,8 @@
|
||||
</h2>
|
||||
<div class="newsContent">
|
||||
<?php echo $news['content']; ?>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'height']) !== 1000):?>
|
||||
<?php if ( $this->getData(['module', $this->getUrl(0), 'config', 'height']) !== -1
|
||||
&& strlen($this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'content'])) >= $this->getData(['module', $this->getUrl(0), 'config', 'height'])):?>
|
||||
<?php echo ' ... <a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '"><span class="newsSuite">lire la suite</span></a>'; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user