Display a List of Posts From a Category
This has been posted several times on the support forums but I want to reproduce it here since it seems to be a common need when building a new site using Graffiti CMS. At least one page will probably need to display a list of posts from an arbitrary category. The chalk code that you need to insert into the appropriate view file is as follows:
#set($categoryposts = $data.PostsByCategory("Arbitrary Category", 10))
#foreach($categorypost in $categoryposts)
$categorypost.Title :: $categorypost.Body
#end
Also, if you want to use the category for the current category page being displayed you can use the category name from the provided $category variable as follows:
#set($categoryposts = $data.PostsByCategory($category.Name, 10))
#foreach($categorypost in $categoryposts)
$categorypost.Title :: $categorypost.Body
#end

Comments: