Last active
August 29, 2015 14:02
-
-
Save katzueno/c461fd46a5a7699b68a3 to your computer and use it in GitHub Desktop.
concrete5:イベント開始時刻・終了時刻をページ属性を使ってテーマなどに表示する方法
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 | |
$week = array("(日) ", "(月) ", "(火) ", "(水) ", "(木) ", "(金) ", "(土)"); | |
$event_start = strtotime($c->getCollectionAttributeValue("event_start")); | |
$event_start_d = date('Y年m月d日 ', $event_start); | |
$event_start_w = date("w", $event_start); | |
$event_end = strtotime($c->getCollectionAttributeValue("event_end")); | |
$event_end_d = date('Y年m月d日 ', $event_end); | |
$event_end_w = date("w", $event_end); | |
if($event_start){ | |
echo '<p>開催日時:'. $event_start_d . $week[$event_start_w] . date(' H:i', $event_start); | |
if($event_end){ | |
echo '〜'; | |
if ($event_start_d != $event_end_d) { | |
echo $event_end_d . $week[$event_end_w]; | |
} | |
echo date('H:i', $event_end); | |
} | |
echo '</p>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment