ClockInfo.com
Commentary about clock repair and clock history from Bill’s Clockworks and ClockHistory.com

ClockInfo.com

CakePHP: Many views – one controller

By on July 4, 2007

If you want multiple controllers to be able to share a view, do this:

  1. Put the shared views in the views/common directory
  2. Call a shared view like this: $this->render(‘../common/view_name’);
Be Sociable, Share!

No related posts.


2 Responses to “CakePHP: Many views – one controller”

  1. comment number 1 by: AD7six

    … Or
    $this->viewPath = ‘name of view folder’;
    $this->render(‘name of file only’);

    Cheers,

    AD

  2. comment number 2 by: Bill

    Thanks, AD, this looks like it will work great when you want all the views for a controller to come from a certain folder. The other way might be more efficient if you want some views to come from the default view folder and some to come from the common folder.

Leave a Reply

Name

e-Mail (will not be published)

Website