Forums / Setup & design / template variables in custom tags

template variables in custom tags

Author Message

paul bolger

Friday 23 February 2007 2:42:02 am

I have a custom tag set up which calls a template which returns some children of a node according to an attribute filter:

{def $orgs=fetch( 'content', 'list', hash( 'parent_node_id', 369,
'attribute_filter', array( array( 'organisation/type_1',
'=',
'VARIABLE' ) ) ) )}

Where VARIABLE is the value to filter by.

The documentation on custom tags mentions that one can add a variable which would add a class or id to a tag, is it possible to use this mechanism to pass a variable to the template which is being called?

Paul Bolger

Paul Bolger

André R.

Friday 23 February 2007 4:09:53 am

Looking at how factbox is used in ezwebin, content.ini:

[factbox]
CustomAttributesDefaults[align]=right
CustomAttributesDefaults[title]=factbox

And override/templates/datatype/ezxmltext/factbox.tpl:

<div class="object-{if is_set($align)}{$align}{else}left{/if}">
   <div class="factbox">
       <div class="factbox-header">
       	<h2>{if is_set($title)}{$title}{/if}&nbsp;</h2>
	   </div>
       <div class="factbox-content">
       	{$content}
       </div>
   </div>
</div>

Hopfully this is what you are after :)

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

paul bolger

Sunday 25 February 2007 8:53:56 pm

Thanks Andre, that looks like it might do the trick.

Paul Bolger