Sitemap articles par date

This commit is contained in:
fredtempez 2021-04-27 09:25:54 +02:00
parent 78f18afab8
commit b58113a8ef
2 changed files with 45 additions and 10 deletions

View File

@ -1 +1,17 @@
/* Vide */
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
ul {
list-style-type: circle;
}

View File

@ -23,13 +23,22 @@
<!-- articles d'une sous-page blog-->
<ul>
<?php if ($this->getData(['page', $childId, 'moduleId']) === 'blog') { ?>
<?php
foreach($this->getData(['module',$childId]) as $articleId => $article): ?>
<?php if($this->getData(['module',$childId,'posts',$articleId,'state']) === true) {?>
<?php if ($this->getData(['page', $childId, 'moduleId']) === 'blog' &&
!empty($this->getData(['module', $childId, 'posts' ])) ) { ?>
<?php
// Ids des articles par ordre de publication
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $childId,'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayCollumn($this->getData(['module', $childId, 'posts']), 'state', 'SORT_DESC');
$articleIds = [];
foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) {
$articleIds[] = $articleId;
}
}
foreach($articleIds as $articleId => $article): ?>
<?php if($this->getData(['module',$childId,'posts',$article,'state']) === true) {?>
<li>
<a href="<?php echo helper::baseUrl() . $childId . '/' . $articleId;?>"><?php echo $article['title']; ?></a>
<a href="<?php echo helper::baseUrl() . $childId . '/' . $article;?>"><?php echo $this->getData(['module',$childId,'posts',$article,'title']); ?></a>
</li>
<?php } ?>
<?php endforeach;
@ -41,10 +50,20 @@
<?php if ($this->getData(['page', $parentId, 'moduleId']) === 'blog' &&
!empty($this->getData(['module',$parentId, 'posts' ])) ) { ?>
<?php foreach($this->getData(['module',$parentId, 'posts' ]) as $articleId => $article): ?>
<?php if($this->getData(['module',$parentId,'posts',$articleId,'state']) === true ): ?>
<?php
// Ids des articles par ordre de publication
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $parentId,'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayCollumn($this->getData(['module', $parentId, 'posts']), 'state', 'SORT_DESC');
$articleIds = [];
foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) {
$articleIds[] = $articleId;
}
}
foreach($articleIds as $articleId => $article): ?>
<?php if($this->getData(['module',$parentId,'posts',$article,'state']) === true ): ?>
<li>
<a href="<?php echo helper::baseUrl() . $parentId. '/' . $articleId;?>"><?php echo $article['title']; ?></a>
<a href="<?php echo helper::baseUrl() . $parent. '/' . $article;?>"><?php echo $this->getData(['module',$parentId,'posts',$article,'title']); ?></a>
</li>
<?php endif; ?>
<?php endforeach;