dotCMS - Open Source Content Management System, Ondemand CMS, and Professional Support

Document Search

Article Information

Since Version: 1.7
Tags: Creating Macros plugins
Updated: 6/4/2009 9:53:17 AM
By: Jason Tesser
Doc id: 148649
Print Page: Export to PDF

Creating Macros

Macros can be placed directly inside of your plugin within the conf/macros-ext.vm file. If you declare a macro that already exists the previous macro will be commented out and yours macro will be used.

Custom macros can be written here as in the following example:


#macro (newMacro $newMacroParameter)
Macro Code written here (or another file with macro code can be parsed or included)
#end

After creating the custom macro, and saving it to the recommended .vm file, it can then be called from any piece of content, container, or template as any other macro:
#newMacro($newMacroParameter)

*While it is possible to add macros to any velocity page, if you add them to the .vm files in the velocity root, then they are loaded once into memory and don't have to be parsed every time.



Post a Comment


Add Comments

   

 
Post