On Mon, 2004-10-18 at 19:50, Peter Speltz wrote:
> --- Perrin Harkins <perrin at elem.com> wrote:
> > I'm confused then. What do you need an object for? Just call the class
> > method.
>
> I'm trying to access the method in a TT template. Does that answer your
> question? In a TT template you need an obj ref to call any methods of a class
> , whether they are class methods or not. I tried [% Customer::types%] and it
> gave a parse error so i'm deducting this assertion from that experiment (and
> probably others).
You are correct, the TT stash code doesn't allow you to use the dot
notation to call a class method. I usually do things like that before
running the template and just pass the data in. However, there are ways
to do it from the template. You could use a [% PERL %] section to do
it, or go the plugin route that others have suggested. I would consider
the [% PERL %] section a last resort.
> As an aside, this question started with Maypole , where every default model
> method sends the template an object(s) of the appropriate type unless you're
> creating a new object of that type. Then you have no object.
Makes sense to me. All the data you need to generate the form should be
available through class methods.
Also, thanks for the kind words.
- Perrin
_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole
This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT