Wednesday, March 2, 2011

Re: use alternative view folder?

I am doing something similar for A/B testing and also to present
different checkout pages to users depending on which country they come
from.

I have several views for the affected actions, named whatever-a.ctp,
whatever-b.ctp .... and in the controller put a call to $this-
render() at the end of the action to specify which version to render.

In my case this simple approach works great but I am using it for a
couple of actions, if you need to apply it to a whole project then you
should look for another solution that probably implies changing the
views folder on the fly.

Regards


On 1 mar, 10:47, acl68 <c...@anjaliebermann.de> wrote:
> Why do you need this version2?
>
> I think it isn't possible what you ask, but if you explain a bit more
> detailed, what you want to achieve, there might be another solution.
>
> Who should see version2 in which case?
>
> Anja
>
> Am Dienstag, 1. März 2011, um 10:01:35 schrieb K3:> Hi,
>
> > if i add another subfolder in /app/view where i want to put
> > alternative view structure of the site, so for example for articles
> > folder i have following structure:
>
> > /app/
> >      /view/
> >             /_version2/
> >                    /articles/
> >      /articles/
>
> > and i have 2 files
> > /app/view/articles/index.ctp and /app/view/_version2/articles/
> > index.ctp
>
> > In general i want to render view from alternative folder if that view
> > exists. something like:
>
> > if ("/app/view/_version2/xxxxxx/yyyyy.ctp" exists) {
> >        render("/app/view/_version2/xxxxxx/yyyyy.ctp");
> > } else {
> >        render("/app/view/xxxxxx/yyyyy.ctp");
> > }
>
> > is this possible?
> > i wanted to add such control in beforeRender, but seems there i can't
> > control which view to render, only to post variables to the view. Any
> > thoughts?
>
> > Thanks in advance

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: