Musings of a Gotham City Geek

What is the sound of one blog clapping?

 

Chalk it up to Rails?

Note: I post this because this CMS can be run on the Mono stack on *nix and Mac. Also, it is interesting to note, the combination of embedded code in the html, or vice-versa, while having a flavor of classic ASP, hints at some of the newer features availablr in templating in Ruby on Rails…

Graffiti uses a very simple templating language to render its themes called Chalk (Chalk is the combination of NVelocity and Graffiti goodies).

While we do call this a language, do not let the name full (sic) you. Chalk is much simpler than anything you have used to build web pages in the past. With this system, you can write your HTML/CSS as you would do normally and then decorate it Chalk. When Graffiti renders a view file, it will find all of your Chalk items and replace with your site content.

Here are some of the more common things you will do with Chalk.

Properties - Format $ItemName.PropertyName - properties allow you access to addition information about an item. As an example, to display the title of a post, you would use $post.Title

Methods - Methods are similar to properties except they usually require you supply additional information. As an example, to render a list of comma seperated tags as links for the current post and wanted to avoid writing a lot of Chalk, you could use the TagList method on the macros helper: $macros.TagList($post.TagList). Here we are passing in the $post.TagList property to the macros.TagList method.

Conditions - There are times you will want content shown only if a certain criteria is met, to do so you can use an if/elseif/else. Most conditional operators are supported (==, >, >=, <, <=, !=).

Blog comments powered by Disqus