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 = [
|
public static $height = [
|
||||||
200 => 'Petite',
|
200 => 'Petite',
|
||||||
400 => 'Moyenne',
|
600 => 'Moyenne',
|
||||||
600 => 'Grande',
|
1200 => 'Grande',
|
||||||
1000 => 'Article complet'
|
-1 => 'Article complet'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Signature de l'article
|
// Signature de l'article
|
||||||
@ -427,9 +427,13 @@ class news extends common {
|
|||||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||||
self::$news[$newsIds[$i]] = $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i]]);
|
self::$news[$newsIds[$i]] = $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i]]);
|
||||||
// Longueur de la news affichée
|
// Longueur de la news affichée
|
||||||
if ($this->getData(['module', $this->getUrl(0), 'config', 'height']) !== 1000) {
|
if ( $this->getData(['module', $this->getUrl(0), 'config', 'height']) !== -1
|
||||||
self::$news[$newsIds[$i]]['content'] = substr($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'content']), 0,
|
&& strlen($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'content'])) >= $this->getData(['module', $this->getUrl(0), 'config', 'height']) ) {
|
||||||
$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
|
// Mise en forme de la signature
|
||||||
self::$news[$newsIds[$i]]['userId'] = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'userId']));
|
self::$news[$newsIds[$i]]['userId'] = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'userId']));
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
</h2>
|
</h2>
|
||||||
<div class="newsContent">
|
<div class="newsContent">
|
||||||
<?php echo $news['content']; ?>
|
<?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 echo ' ... <a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '"><span class="newsSuite">lire la suite</span></a>'; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user