Ir Even better just bake it... if you can't bake it then:

(i haven't played with 1.2 yet, but unless it was drastically changed
from 1.1.x, this is how you i do it:)

change:
turn on admin routing, then:
http://www.domain.com/admin/controller/action

class ControllerController extends AppController
{
    function admin_index()
    {
        $this->set('controller',$this->Model->findAll());
    }
    function admin_action()
    {
        $this->checkSession(); // a function in the AppController, app/
app_controller.php which checks the user is logged in and has
permissions
        if(empty($this->data))
        {

        }
        else
        {
            if($this->Model->save($this->data))
            {
                $this->Session->setFlash('Model is saved');
                $this->redirect('/admin/controller/index');
            }
        }
    }
}

You shouldn't even have to call "this->render()" at all.

Then you name your views:
app/views/controller/admin_index.thtml
app/views/controller/admin_action.thtml

(replace thtml for ctp in 1.2)

On Mar 25, 5:05 pm, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> Or even better, no parameter needed:
>
> function admin_add()
> {
>         return $this->setAction('add');
>
> }
>
> function add()
> {
>         if (isset($this->params[CAKE_ADMIN]))
>         {
>                 $this->render('admin_add');
>         }
>
> }
>
> -MI
>
> ---------------------------------------------------------------------------
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> blog:http://www.MarianoIglesias.com.ar
>
> -----Mensaje original-----
> De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
> de Mariano Iglesias
> Enviado el: Domingo, 25 de Marzo de 2007 05:53 p.m.
> Para: [email protected]
> Asunto: RE: Admin Routing Techniques
>
> No, setAction() will set the $controller->action to 'add' and therefore
> render() will render add.ctp
>
> But you can use a parameter:


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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