Created
February 3, 2015 00:46
-
-
Save katzueno/108608054b56d674e225 to your computer and use it in GitHub Desktop.
Event Category Label (Image) Sample Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
defined('C5_EXECUTE') or die("Access Denied."); | |
$th = Loader::helper('text'); | |
$dh = Loader::helper('date'); | |
$v = View::getInstance(); | |
?> | |
<ul class="event__list"> | |
<?php foreach ($pages as $page): | |
$title = $th->entities($page->getCollectionName()); | |
$url = $nh->getLinkToCollection($page); | |
$target = ($page->getCollectionPointerExternalLink() != '' && $page->openCollectionPointerExternalLinkInNewWindow()) ? '_blank' : $page->getAttribute('nav_target'); | |
$target = empty($target) ? '_self' : $target; | |
$event_date = $page->getAttribute('event_date'); | |
$date = $dh->date('Y年m月d日', strtotime($event_date)); | |
$event_type = $page->getAttribute('event_type'); | |
$event_type_handle = ''; | |
$event_type_name = ''; | |
if ($event_type instanceof SelectAttributeTypeOptionList) { | |
$event_type_options = $event_type->getOptions(); | |
foreach ($event_type_options as $o) { | |
$event_type_handle = $o->getSelectAttributeOptionValue(); | |
$event_type_handle = $th->handle($event_type_handle); | |
$event_type_name = $o->getSelectAttributeOptionDisplayValue(); | |
} | |
} | |
?> | |
<li class="<?php echo $event_type_handle;?>"><span class="date"><?php echo $date;?><img src="<?php echo $v->getThemePath();?>/images/eventbtn_<?php echo $event_type_handle;?>.png" alt="<?php echo $event_type_name;?>" class="filtercategory"/></span> | |
<a href="<?php echo $url ?>" target="<?php echo $target ?>" class="listcontent"><?php echo $title ?></a> | |
</li> | |
<?php endforeach; ?> | |
</ul><!-- end .event__list --> | |
<?php if ($showPagination): ?> | |
<div class="pagination__box"> | |
<ul class="pagination__list"> | |
<li><?php echo $paginator->getPrevious('<') ?></li> | |
<?php echo $paginator->getPages('li') ?> | |
<li><?php echo $paginator->getNext('>') ?></li> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment