[Templates] Two Template Questions about Calling Objects
[prev]
[thread]
[next]
[Date index for 2005/05/09]
Hi all, have a few questions and hoped you could shed
some light on them for me.
First, what I'm trying to do. I have a template
List.tt2 which gets called with a hash:
%hash = (
list => [GetListOfObjects],
data => \%another_hash,
);
In List, I want to call loop through list, something
like
Before Objects
[% FOR field=list %]
[% field.writeHTML() %]
[% END %]
After Objects
(Please forgive me if my syntax is off - I'm writing
off the top of my head here)
writeHTML () {
# Write some output using ANOTHER template:
# Object.tt2
}
Question 0: Is this a dumb way to do it?
Question 1:
If I try this, I get:
Before Objects
After Objects
# some output from Object.tt2 comes here
I tried setting $| = 1 to flush output, but that's not
helping. Should writeHTML() be returning a string of
the HTML?
Question 2:
I want to pass %another_hash from List.tt2 to
writeHTML(). If I try writeHTML(another_hash), then I
don't get it as a flat hash ('colour' => 'Green',
etc...) but as a reference to a hash. Can I "expand"
it in any way?
If this were Perl, I'd do writeHTML(%$another_hash),
but it's not Perl...
Thanks for pointers/help/etc :)
--Peter
__________________________________
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
 |
[Templates] Two Template Questions about Calling Objects
Peter Kay 22:13 on 09 May 2005
|