I'm with grant - use one action with a differnt view as needed

function action1($layout = 'list'){
  // set data and other stuff
  switch ($layout){
    case 'table':
      $this->render('action1_table');
      break;
    default:
      $this->render('action1_list');
      break;
  }
}

You could use if...else if there are only two possible options

Geoff
--
http://lemoncake.wordpress.com

On Aug 1, 9:19 am, Grant Cox <[EMAIL PROTECTED]> wrote:
> One of the primary parts of Cake is to keep your data separate from
> your application interface (controllers), separate from your
> presentation (views).  Changing one of these elements should not
> require modification to the others.  You want the first two to remain
> the same, you just want different views.
>
> If the controller functionality remains the same between the different
> modes (list vs table), which I imagine it does, then you should stick
> to a single controller action.  Allow the request to determine what
> format to output, and render the appropriate view from this.  So
> requesting /controller/view/list vs  /controller/view/table  will
> execute the same controller action, but just render the list.ctp or
> table.ctp view file.


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

Reply via email to