Re: One directory for all view files.

2009-03-03 Thread majna

I think that you can put in app_controller
beforeRender() {
 $this->viewPath = ''; or '/'
}
cake populate viewPath with current controller name like "posts" and
search in views/posts/ for files
based on action name.

Now cake will search view files in VIEW directory and all controller
view names must be unique or
set from controller action like:
$this->render('posts_index);

On Mar 3, 11:26 am, Adam Royle  wrote:
> Yes, CakePHP has a separate folder for each controllers views, but I
> would imagine if you had a ton of controllers you might want to separate
> them anyway?
>
> I recommend you stick with the conventions to start with, and further
> down the track if you still want to change it, you'll find a way.
>
> Cheers,
> Adam
>
> lakers fan wrote:
> > Hello,
> >      Can I create all the view files inside one directory. Right now
> > what I understood is you got to create a folder named after
> > controller. if I have many controllers, does it mean that I have to
> > create that many folders for view files?
>
> > Thanks,
> > Bharani
>
> > 
> > Windows Live™ Groups: Create an online spot for your favorite groups
> > to meet. Check it out.
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: One directory for all view files.

2009-03-03 Thread brian

On Tue, Mar 3, 2009 at 5:20 AM, lakers fan  wrote:
> Hello,
>  Can I create all the view files inside one directory. Right now what I
> understood is you got to create a folder named after controller. if I have
> many controllers, does it mean that I have to create that many folders for
> view files?

 How would you make the distinction between the edit view for one
controller or another? Or add, or anything else?

You could name them as, "controller_name_edit.ctp" for instance, but
you'd have to specify the $viewPath and render() for *every* action.
Granted, the $viewPath would always be the same, so maybe it would be
sufficient to specify it in AppController::beforeFilter(). Maybe. That
seems like a huge pain for little gain.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: One directory for all view files.

2009-03-03 Thread Adam Royle
Yes, CakePHP has a separate folder for each controllers views, but I 
would imagine if you had a ton of controllers you might want to separate 
them anyway?

I recommend you stick with the conventions to start with, and further 
down the track if you still want to change it, you'll find a way.

Cheers,
Adam

lakers fan wrote:
> Hello,
>  Can I create all the view files inside one directory. Right now 
> what I understood is you got to create a folder named after 
> controller. if I have many controllers, does it mean that I have to 
> create that many folders for view files?
>
> Thanks,
> Bharani
>
> 
> Windows Live™ Groups: Create an online spot for your favorite groups 
> to meet. Check it out. 
> 
> 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---