Cakephp – Using the same view for multiple controler functions

Question:
I have a Cakephp project the controller has several different methods.

function Index()
function IndexAuthor()

And I want to use the same ‘view’ (or template, Index.ctp) for both of the methods of the control.

Answer:

You’re looking for Controller::render().
function IndexAuthor() {
$this->autoRender = false ;
$this->render('/stories/admin_index');
}

Source: http://stackoverflow.com/questions/1753585/cakephp-same-view-for-multiple-functions

No Comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>