eZ Community » Forums » Setup & design » template variables in custom tags
expandshrink

template variables in custom tags

template variables in custom tags

Friday 23 February 2007 11:42:02 am - 2 replies

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

Friday 23 February 2007 1:09:53 pm

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 happy.gif Emoticon

Monday 26 February 2007 5:53:56 am

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

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu