Skip to content

Instantly share code, notes, and snippets.

@endymion
Created April 24, 2017 15:59
Show Gist options
  • Save endymion/f788fb06d8f9e68108ae9c52314afb97 to your computer and use it in GitHub Desktop.
Save endymion/f788fb06d8f9e68108ae9c52314afb97 to your computer and use it in GitHub Desktop.
'next upcoming event' Marketo template code
<h2>Custom Objects</h2>
<table>
<tr>
<th>#</th>
<th>date</th>
</tr>
#foreach($object in $openTableReservation_cList)
    <tr>
<td>$foreach.count</td>
<td>
#set($x = $object.reservationDate)
#set($parsed_date = $convert.parseDate($x, "yyyy-MM-dd"))
#set($reservation_date = $date.format("EEEE, MMMM d, yyyy", $parsed_date))
$reservation_date
</td>
</tr>
#end
</table>
<h2>Next Upcoming<h2>
#set($next_upcoming = "")
next upcoming: $next_upcoming<br/>
#foreach($object in $openTableReservation_cList)
1<br/>
#set($fake_now = $convert.parseDate("2016-05-13", "yyyy-MM-dd"))
fake now: $fake_now<br/>
#set($reservation_date = $object.reservationDate)
#set($parsed_reservation_date = $convert.parseDate($reservation_date, "yyyy-MM-dd"))
reservation date: $parsed_reservation_date</br>
#set($is_upcoming = $date.difference($fake_now, $parsed_reservation_date).getSeconds())
is_upcoming: $is_upcoming</br>
#if($is_upcoming >= 0)
UPCOMING<br/>
#set($is_next = $date.difference($parsed_reservation_date, $parsed_next_upcoming_reservation_date).getSeconds())
is_next: $is_next</br>
#if(($next_upcoming == "") || ($is_next > 0))
NEXT<br/>
#set($next_upcoming = $object)
#set($next_upcoming_reservation_date = $next_upcoming.reservationDate)
#set($parsed_next_upcoming_reservation_date = $convert.parseDate($next_upcoming_reservation_date, "yyyy-MM-dd"))
next upcoming reservation date: $parsed_next_upcoming_reservation_date</br>
#end
#end
<br/>
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment