Creating an Event Calender in Graffiti CMS

So you’re happy with Graffiti CMS but now you want to create a pseudo event calender using a Graffiti post to hold the event details.  This particular task is demonstrated very well in the training theme that can be downloaded for free through the Graffiti CMS control panel.  The setup requires the use of custom fields and some custom chalk code in your theme.  Following these steps will get you started:

  • Add two custom fields (more info) and assigning them to the events category (more info).  The custom fields are named Location and Date
  • Add something like the following code to your layout.view, in the training theme this is home.layout.view

#foreach ($post in $data.PostsByCategory(“Upcoming Events”, 3))
<a href=”$post.Url”>
<img src=”$post.ResolvedImageUrl” width=”280″ height=”110″ class=”attach” />
$post.Title
</a>
$post.Custom(“Location”) | $post.Custom(“Date”)
$post.PostBody
#end

Leave a Reply

Your email address will not be published. Required fields are marked *