[Maypole] additional_data and template_args

Peter Speltz peterspeltz@yahoo.com
Mon, 3 Jan 2005 20:55:26 -0800 (PST)


> If I've understood you properly, you have, or would have, a method 
> called menu_data in your model subclasses. When it's called it generates 
> some object-specific data structure or text string and attaches it to 
> the template_args hash so it is made available as a template variable.
> 

object-specific or class-specific depending on if its called how it's called.

> If that's so, I think there's a simpler solution. Delete the last line 
> of menu_data! Don't attach the data structure to a template variable, 
> just return the data structure directly. Then change where it's called. 
> Instead of calling it in additional_data, call it directly as an object 
> method in the template:  [% menu = customer.menu_data %]
> 

Still really the same problem though.  You need to put that in every template
you want menu data or put it in a template that it is included in every
template. It'd be something like:
[% IF objects.size == 1; obj = objects.0;  
   ELSE; USE obj = Class("$classmetadata.name"); 
   END;  
   menu = obj.menu_data; 
%]
 
Truth is though, i have a single wrapper I use all my pages within so I only
need to put that in there and that's a fine solution for now. But i'd much
rather just put it in additional_data once and be done with it. Aslo, maybe
someone else's templating system isn't as cool as TT and they don't have
wrappers or includes.  It may be a problem.

thanks

=====
pjs


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250