In AppController::beforeFilter()
if (isset($this->params['prefix']) && $this->params['prefix'] ==
'admin' && $this->params['admin'] == 1)
{
$this->layout = 'admin_default';
}
On May 9, 9:23 am, fabio <3bi...@gmail.com> wrote:
> Hello mates,
>
> i'm experimenting a problem while passing from 1.2 to 1.3 regarding
> how to set a style from app_controller.php
>
> Basicly i've a simple kind of admin area using the Auth component and
> what i need is to set a custom style for all the views in the admin
> area:
>
> ie
>
> app/views/users/admin_add.ctp
> app/views/users/admin_index.ctp
> app/views/users/admin_edit.ctp
> app/views/users/admin_view.ctp
>
> app/views/posts/admin_add.ctp
> app/views/posts/admin_index.ctp
> app/views/posts/admin_edit.ctp
> app/views/posts/admin_view.ctp
>
> ..............
> ..............
> ..............
>
> Now, to get this in Cake 1.2 I did define custom layout&style files,
> like this:
>
> ---------------------------
> app/views/layouts/admin.ctp
> ---------------------------
>
> <html>
> <head>
> <title><?php echo $title_for_layout; ?></title>
> <?php
> echo $this->Html->css('admin');
> echo $scripts_for_layout;
> ?>
> </head>
> <body>
> ....
> ....
> ....
> </body>
> </html>
>
> -------------------------
> app/webroot/css/admin.css
> -------------------------
> ...
> ...
> ...
>
> and then added the following:
>
> ----------------------
> app/app_controller.php
> ----------------------
>
> <?php
> class AppController extends Controller {
>
> function beforeFilter() {
> if (isset($this->params['admin'])) {
> $this->layout = 'admin';
> }
> }}
>
> ?>
>
> Strangely the same approach is not working on Cake 1.3: when I point
> to an admin view i keep on seeing the default cake layout with style
> cake.generic.css
>
> Is there anybody who can see where I am wrong and why it works on 1.2
> and not on 1.3 ?
>
> Thanks a lot in advance
>
> Tres
>
> P.S.
> Maybe it's worth to say also that i have the following line in app/
> config/routes.php:
>
> Router::connect('/admin', array('controller' => 'users', 'action' =>
> 'index', 'admin' => true));
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment