You need to write a view for all controller functions generally speaking
where a page (output) is required. With some tricks like using the render
function, and careful coding in your view, (eg not hard coding the action
name) you can share the same view across more than one action. The cake form
helper automagically makes some changes to the form opening tag depending on
whether an ID is set or not, the book.cakephp.org will probably elaborate
for you.

Most obviously, the add() and edit() functions can often be the same form,
if the view is coded carefully and conforms to cake standards.  Use
something like $this->render('edit') within the add() method. Alternatively,
don't have a specific add method and have your edit method assume that no
supplied ID means a new one. That might work in your circumstances, or maybe
not.


For delete() functions, once the activity is completed, set a flash message
(i.e. success/failure)
then use something like $this->redirect('/items');  ... or....
$this->redirect($this->referer());




On Mon, Nov 10, 2008 at 8:02 AM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> hi,
>
> I have may function in controller, & i create view for all function
> like
> class cartcontroller extends AppController
>  {
>        var $name= 'carts';
>        var $uses= array('carts','products','categorys');
>
>        function Add()
>        {
>
>
>        }
>        function Edit()
>        {
>
>
>        }function Delete()
>        {
>
>
>        }
> }
> My question is that ::
>  1)  it's necessary to crate view for every  function ?
>  2) if i don't required view for delete function then what i have to
> do?
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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