I use macros for recursive processing.
When I've tried to use Process for this it errors out.
Am I doing this wrong?
For example:
[%- MACRO make_element( current_element )
BLOCK;
FOREACH tag_name IN current_element.keys;
tag = current_element.$tag_name;
"<$tag_name";
attr = tag.attr;
IF attr;
PROCESS attributes.htm;
END;
IF tag.uni;
" />";
ELSE;
">";
IF tag.content;
FOREACH content IN tag.content;
IF content.length;
FILTER html;
"$content";
END;
ELSE;
make_tag( content );
END;
END;
END;
"</$tag_name>";
END;
END;
END
-%]
Thanks,
Boysenberry
boysenberrys.com | habitatlife.com | selfgnosis.com
On Sep 22, 2006, at 10:37 AM, Perrin Harkins wrote:
Evan Carroll wrote:
Could someone please juxtapose PROCESS w/ ARGS, vs, MACRO? I'm
confused
as to which one to use.
It's a matter of scope. If want to split out some repeated code
that no other template will use, make it a MACRO in the current
template. If you have something that other templates might
conceivably use too, make it a separate template and call it with
PROCESS.
In practice, I have almost no use for MACRO.
- Perrin
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates