Using Graffiti CMS Macros

Generally speaking, macros are a short piece of code that help you to easily change the appearance and layout of your site.  Technically speaking, macros are Chalk Extensions exposed in the Graffiti core that you can use to build or customize a theme.  While it is true that any of the standard public Chalk items  (ie. $post.Body) can be considered "macros", the tips discussed below are focused specifically on the functionality provided by the $macros class.  The $macros class contains helper methods and properties that are available on every page request.  Here are a few of the most common $macros that you will want to get familiar with:

Learning and using these macros will give you the tools you need to quickly develop new themes.  The most common question that is asked regarding macros is, "How do you know what macros are available?".   Many of the macros can be found from the Macros Overview page with descriptions and here is a full list (without descriptions) from version 1.0.1.

If you commonly use a macro that isn't listed here, feel free to leave a comment and be sure to include an example of how it can be used.

 

No Comments