Resuable 'list' type templates

A general technical discussion area for patTemplate.
Locked
User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Resuable 'list' type templates

Post by Geraint » Mon Aug 14, 2006 2:46 pm

I have a useful little template that gives me some an "array" of form outputs based on an input array of data I pass in using addRows("info_list",$myDataArray)

Code: Select all

<mos:tmpl name="info_list" type="condition" conditionvar="type" >
<mos:sub condition="text">
	<tr>
	<mos:Call template="sctextbox" label="{LABEL}" name="{NAME}" size="{SIZE}" value="{VALUE}" tooltip="{TOOLTIP}"/>
	</tr>
</mos:sub>
<mos:sub condition="checkbox">
	<tr>
	<mos:Call template="sccheckbox" label="{LABEL}" name="{NAME}" size="{SIZE}" value="{VALUE}" tooltip="{TOOLTIP}"/>
	</tr>
</mos:sub>
...
</mos:tmpl>
Now what I'd like to do is reuse this template by calling it from other templates.  However it appears that if a template is "called" (via mos:Call) addRows("info_list",$myDataArray) no longer populates it correctly. 

I guess this makes some sense since the info_list template could be called numerous times and addRows would have no way of knowing which instance to populate.

Am I correct or is there a way to tell addRows to popupulate the appropriate instance of the called info_list template - I would've hoped that someting like addRows("callingTemplate.info_list",$myDataArray) would have been possible to populate the instance of the  info_list template called within the "callingTemplate" template.

Thanks for any insights

Geraint

 
dynedain
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 200
Joined: Wed Aug 24, 2005 7:20 pm
Location: Los Angeles
Contact:

Re: Resuable 'list' type templates

Post by dynedain » Mon Aug 14, 2006 10:32 pm

This seems to be a shortcoming of PatTemplate. I've been running into the same situation in adding arrays or objects (vs rows).

If there is a way of reusing lists/arrays/objects without adding a second set, I'd love to know.

 

Locked

Return to “patTemplate”