Thursday, July 30, 2009

Smarty syntax error: unrecognized tag 'dynamic' and Block functions

I ran into this error while working with Smarty caching.  This error is caused by a "dynamic" block function not being registered with Smarty.  A block function is a function which essentially will take a section of content and execute a function on that content.  Because of this, Smarty will not cache it.  Notice in this example the smarty_block_dynamic function simply returns the content.  Because it was defined as "dynamic" you can use the Smarty dynamic tags to wrap content and avoid the caching engine.

This is not a default tag in Smarty and will fail if you have not registered the block function as provided in the example.

No comments:

Post a Comment