Reputation: 1794
How to create custom markup (template) tags for use in CMS pages in magento ? I mean tags like {{block}}.
I have some block that is going to be used often, something like:
{{block type="module/very_long_block_type_title" template="long/path/to/template/file.phtml" id="2"}}
Type and template is always the same, only argument "id" changes. Its quite annoying to retype or searching for copy all the time i have to insert that block, so i thought it would be cool to create my own tag, like:
{{yeah id="2"}}
That is kind of override for tag above.
Somebody know how to do that ?
Upvotes: 1
Views: 1025
Reputation: 23205
You could rewrite Mage_Core_Model_Email_Template_Filter
and add a yeahDirective()
to do what you want, but that's overkill to solve what is essentially an issue of laziness (no rudeness intended). There are any number of snippet managers available for all major platform which you could use.
You can set a template parameter on the block via the block _construct() or _prepareLayout() methods if you like. This pattern of setting a "default" template is used by the core team.
Upvotes: 4