Skip to content

Instantly share code, notes, and snippets.

@kanetei
Created Dec 10, 2019
Embed
What would you like to do?
【concrete5】日付ナビで日付毎の件数を表示するサンプルコード
<?php defined('C5_EXECUTE') or die("Access Denied."); ?>
<aside class="blog-sidenav__list">
<h5 class="list-title"><?=h($title)?></h5>
<p class="view-all"><a href="<?=URL::to('/store/blog/archive')?>">一覧を見る</a></p>
<?php if (count($dates)) { ?>
<ul class="list-archive row">
<?php foreach ($dates as $date) { ?>
<li class="medium-6 columns<?php
if($date === end($dates)) {
echo ' end';
}
?>"><a class="archive-link" href="<?=$view->controller->getDateLink($date)?>"<?php
if ($view->controller->isSelectedDate($date)) {
?> class="selected"<?php
}
?>><?=$view->controller->getDateLabel($date)?>年(<?php
$list = new \Concrete\Core\Page\PageList();
$list->filterByPageTypeHandle('store_blog');
$year = $view->controller->getDateLabel($date);
$yearStart = $year.'-01-01';
$list->filterByPublicDate($yearStart,'>=');
$yearEnd = $year.'-12-31';
$list->filterByPublicDate($yearEnd,'<=');
$pages = $list->getResults();
echo count($pages);
?></a></li>
<?php } ?>
</ul>
<?php } else { ?>
<p><?=t('None.')?></p>
<?php } ?>
</aside>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment