On 5/4/07, Frédéric <[EMAIL PROTECTED]> wrote:
> I would like to be able to choose a display template for each page of
> album. As these templates will be done by web designers, I think they will
> be just kid templates.
>
> So, I will store a template name in each page, and this template will need
> to be dynamically loaded. How can I do that in TG?
Hi Frédéric,
To override the standard template used in a controller (ie,
@expose("my.template.name")), pass "tg_template" in the dictionary you
return from your controller. So, if the template is stored in a
database, then you can just pass the name in the tg_template part of
the dictionary you return.
> Second, I think it will be great to use widgets; are they a good choice to
> put non-form-based pages? As I don't want to mix python code and web
> design, how can I load a kid template from a widget?
Widgets contain a template variable that contains the Kid template
(either the whole template, or a filename) to be used when it is to be
displayed. You'd then include the widgets from your page template.
You'd generally not have a single widget to display all the page - the
page would use multiple widgets.
Neil
--
Neil Blakey-Milner
http://nxsy.org/
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---