Right you are, I did miss something.

Should have been looking at it from a more widget centric view.

On Oct 28, 7:06 pm, "Diez B. Roggisch" <[email protected]> wrote:
> Kalium schrieb:
>
>
>
>
>
> > On Oct 27, 7:27 pm, "Diez B. Roggisch" <[email protected]> wrote:
> >> Kalium schrieb:
>
> >>> Hi,
> >>> I'm looking for a way to have one controller render more than one
> >>> template. I'm not looking to dynamically _change_ which template I'm
> >>> using, I just want to be able to use the same two templates always.
> >>> I could of course just combine the two templates into one template and
> >>> all my problems would be solved. I would rather though keep them
> >>> seperate. This makes it much easier to reuse one in a place I may not
> >>> want to use the other.
> >> I don't understand this. Do you always want to render *both* templates
> >> at the same time? That makes not much sense to me - after all, you have
> >> to deliver *one* HTML-document to the browser.
>
> >> So maybe you can elaborate on what your actual use-case is. Then we
> >> might come up with a solution, most probably something along widgets or
> >> template inheritance.
>
> >> Diez
>
> > I do always want to render *both* templates with this one particular
> > controller, but that doesn't mean that
> > the templates will always be rendered together by a *different*
> > controller.
>
> > So just say I have one controller for my index page with a template
> > that will show the following
> > * Football teams
> > * Garden plants
>
> > Now If I have another page somewhere else where I only want to display
> > the Garden plants only,
> > I would possibly have to just copy and paste the Garden plants
> > specifics from the index template and create another template
>
> > What's better though (IMHO) is to create a template for Football
> > teams, and for Garden plants, so then in your index template
> > you can have something like (I'm using Kid...not Genshi)
>
> > ${include Football.kid}
> > ${include Garden.kid}
>
> > I've actually found a post on stackoverflow which asks the exact same
> > question, and actually gives the exact same answer that
> > Uwe Schroeder gave me (as well as a clunky way to do it in Kid).
>
> > Perhaps I've missed something along the way though?
>
> Yes, widgets. Just create a Footballteams-widget, and a
> GardenPlants-widget. Both have their respective template.
>
> In index.kid, you then have
>
> ${teams_widget.display(teams)}
> ${plants_widget.display(plants)}
>
> In others only the one you are interested in.
>
> Diez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to