ZwiiCMS/module/blog/view/index/index.php

51 lines
1.9 KiB
PHP
Raw Normal View History

2018-04-02 08:29:19 +02:00
<?php if($module::$articles): ?>
<div class="row">
<div class="col12">
<?php foreach($module::$articles as $articleId => $article): ?>
<div class="row rowArticle">
2019-02-22 22:38:06 +01:00
<div class="col3">
<?php
2020-04-07 10:17:42 +02:00
// Déterminer le nom de la miniature
$parts = explode('/',$article['picture']);
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $article['picture']);
// Créer la miniature si manquante
if (!file_exists( self::FILE_DIR . 'thumb/' . $thumb) ) {
$this->makeThumb( self::FILE_DIR . 'source/' . $article['picture'],
self::FILE_DIR . 'thumb/' . $thumb,
self::THUMBS_WIDTH);
}
?>
2019-02-22 22:38:06 +01:00
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>" class="blogPicture">
2020-04-07 10:17:42 +02:00
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>" alt="<?php echo $article['picture']; ?>">
</a>
</div>
<div class="col9">
2019-02-22 22:38:06 +01:00
<h1 class="blogTitle">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">
<?php echo $article['title']; ?>
</a>
</h1>
2018-04-02 08:29:19 +02:00
<div class="blogComment">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>#comment">
<?php echo count($article['comment']); ?>
</a>
<?php echo template::ico('comment', 'left'); ?>
</div>
2019-02-22 22:38:06 +01:00
<div class="blogDate">
<i class="far fa-calendar-alt"></i>
2020-10-02 17:07:14 +02:00
<?php echo strftime('%d %B %Y', $article['publishedOn']); ?>
2018-04-02 08:29:19 +02:00
</div>
<p class="blogContent">
<?php echo helper::subword(strip_tags($article['content']), 0, 400); ?>...
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">Lire la suite</a>
</p>
</div>
2018-04-02 08:29:19 +02:00
</div>
<?php endforeach; ?>
</div>
</div>
<?php echo $module::$pages; ?>
<?php else: ?>
<?php echo template::speech('Aucun article.'); ?>
<?php endif; ?>