Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h2 class="topper black">Upcoming Events:</h2>
- <txp:variable name="CALPIPE"><txp:aks_cache id="CALPIPE"><txp:php>echo file_get_contents("YOURYAHOOPIPEJSONFEEDURL");</txp:php></txp:aks_cache></txp:variable>
- <txp:php>
- date_default_timezone_set('America/Chicago');
- $json = json_decode(parse('<txp:variable name="CALPIPE" />'), true);
- if(empty($json)) return;
- $oldate = '';
- foreach($json['value']['items'] as $i => $a) {
- $ts = strtotime($a['start']);
- $te = strtotime($a['end']);
- $title = htmlspecialchars($a['title']);
- $location = htmlspecialchars($a['location']);
- if($oldate != ($date = strftime('%a, %B %e:', $ts)))
- echo $i ? "</h3>\n<h3 class=\"event-date\">" : "<h3 class=\"event-date first\">", ($oldate = $date), "</h3>\n";
- if (empty($a['location']) && strftime('%I:%M%P', $ts) == '12:00am')
- echo '<strong>', $title , '</strong></div>';
- elseif (strftime('%I:%M%P', $ts) == '12:00am' && isset($a['location']))
- echo '<strong>', $title , '</strong><br />' , $location ,'<br /><br />';
- elseif (strftime('%I:%M%P', $ts) != '12:00am' && empty($a['location']))
- echo '<strong>', $title , '</strong><br />' , strftime('%l:%M%P', $ts) ,' - ' , strftime('%l:%M%P', $te) ,'<br /><br /></div>';
- else echo '<strong>', $title , '</strong><br />' , strftime('%l:%M%P', $ts) ,' - ' , strftime('%l:%M%P', $te) ,'<br />' , $location ,'<br /><br />';
- }
- </txp:php>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement