These steps will help:

1.
uncomment the admin route in config.php:
define('CAKE_ADMIN', 'admin');

2.
bake the admin stuff (Models, views, controllers)
the admin views have a 'admin' prefix to the files: admin_index.ctp
they will use the default layout.
to change that, step 3

3.
copy the default cake layout from the cake folder, name it
/views/layouts/admin.ctp
add this function to the beforeFilter() of app_controller, so it'll
change the layout to admin, when admin route is in use.
        function checkLayout()
        {
                //debug($this->params['admin']);
                if(isset($this->params['admin']) && $this->params['admin'] == 
'admin')
                {
                        $this->layout = 'admin';
                }
        }

to add it, use
var $beforeFilter  = array('checkAccess','checkLayout');

or something like that. checkAccess is to check access :]
 it will redirect user to login page if he tries to see any admin
actions without authentication.


 How could this be simpler ? :)

 spark



On 9/13/07, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
> On 9/13/07, DGPhoebus <[EMAIL PROTECTED]> wrote:
> >
> > Thanks French.  So by this method you would still have to build the
> > "Admin" functions into the front end of the site (only viewable to
> > admin users.) ?  No separate admin area?
>
> Correct.  But I don't know why you call it the "front end of the
> site".  I say why go through the trouble of creating a completely
> separate admin area with potentially two sets of code to maintain when
> you can just add those actions into your controller and then have
> access to anything that the rest of the controller can use.
>
> I've built lots of admin systems before, and in addition to being very
> tired of doing so I've started adding stuff to my applications that
> only shows up if you're an admin.  No more standalone admin areas for
> me if I can help it.
>
> Hope that helps.
>
> --
> Chris Hartjes
> Senior Developer
> Cake Development Corporation
>
> My motto for 2007:  "Just build it, damnit!"
>
> @TheBallpark - http://www.littlehart.net/attheballpark
> @TheKeyboard - http://www.littlehart.net/atthekeyboard
>
> >
>


-- 
[livesets] http://djspark.com.br/
[web] http://sydi.net
[filmes] http://melhoresfilmes.com.br

--~--~---------~--~----~------------~-------~--~----~
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