You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Martin Grotzke <ma...@javakaffee.de> on 2008/02/07 15:10:22 UTC
Re: T5 template selection based on the current request
(e.g. request parameters)
On Thu, 2008-02-07 at 14:26 +0100, Chris Lewis wrote:
> I'm not 100% clear either. A page class has one and only one page
> template, albeit localizeable.
What do you think about the mentioned solution
(http://www.nabble.com/T5%3A-Personalizing-page-and-component-template-td14098291.html)?
It's somehow confusing to find a solution that show custom template
selection and to read that "A page class has one and only one page"...
Thanx for clarification,
cheers,
Martin
> It seems like you'll need to do at least
> 2 things:
>
> 1. Use a Layout component specific to the user/page.
> For this you will have your page template wrap itself in a layout
> component, the exact type of which must be determined at runtime. If I'm
> not mistaken there is a way to do this using a delegate or placeholder,
> but you'll need to look at the core docs to be sure.
>
> 2. Embed blocks your page component which render the specifics.
> You can render these blocks conditionally using <t:if>. Granted your
> page will look a bit cobbled, but that is what requirements like this
> dictate. I've not heard of any method more elegant than this
> unfortunately - you can see the same thing in RoR (widgets, etc).
>
> Hope this helps - sorry I couldn't be more specific about the dynamic
> layout.
>
> chris
>
> Martin Grotzke wrote:
> > Yep, you're right. But there are several posts that state that there is
> > a one-to-one relationship of page class and template (with support for
> > i18n'ed templates). Having such a simple solution I wonder where these
> > statements come from and if they are completely wrong.
> >
> > And the question is, if the mentioned solution works correctly without
> > side effects, having the full template lifecycle supported (however this
> > works in detail).
> >
> > So do you say, that the shown solution is working correctly?
> >
> > Thanx && cheers,
> > Martin
> >
> >
> >
> > On Thu, 2008-02-07 at 01:17 +0100, Renat Zubairov wrote:
> >
> >> Hello Martin,
> >> What isn't clear, is what is the question? If it's how to implement it I
> >> guess the post you've already found describes it good enough.
> >>
> >> Renat
> >>
> >> On 06/02/2008, Martin Grotzke <ma...@javakaffee.de> wrote:
> >>
> >>> Hello,
> >>>
> >>> I have a question concerning the relation between template and page
> >>> class, which admittedly has already been raised sometimes :)
> >>>
> >>> Especially, the thread "T5: Personalizing page and component template"
> >>> (
> >>> http://www.nabble.com/T5%3A-Personalizing-page-and-component-template-td14098291.html
> >>> )
> >>> seems to show a solution for I want to achieve (or, to be honest, my
> >>> collegues need in a project they are starting).
> >>>
> >>> The requirement is to select the chosen page template (or even the
> >>> template of the layout component) at request time based on e.g. some
> >>> request parameters, session attribute or s.th. else. I think common use
> >>> cases are whitelabeling, country specific templates, personalization and
> >>> there are probably a lot more.
> >>>
> >>> I would asume that some of you also have this requirement, so I (and my
> >>> collegues :)) would be happy if you could share your experiences /
> >>> solutions concerning this requirement.
> >>>
> >>> Jeffrey, as you already presented your solution (mentioned above), did
> >>> you experience any drawbacks/problems with this implementation?
> >>>
> >>> Thanx in advance,
> >>> cheers,
> >>> Martin
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>