小编hem*_*ppa的帖子

CakePHP管理部分路由和重定向

我正在努力在CakePHP项目中创建一个管理部分的概念.(版本2.3.5)

我在Config/core.php中取消注释了这一行:

Configure::write('Routing.prefixes', array('admin'));
Run Code Online (Sandbox Code Playgroud)

我在Config/routes.php中添加了一行:(就像他们在CakePHP cookbook中的建议一样.)

Router::connect('/admin', array('controller'=>'pages', 'action'=>'index','admin' => true));
Run Code Online (Sandbox Code Playgroud)

在AppController.php中,我有以下内容:

    public $components = array(
    'Session',
    'Auth' => array(
        'loginRedirect'=>array('controller'=>'pages','action'=>'index', 'admin'=>true),
        'logoutRedirect'=>array('controller'=>'pages','action'=>'display','home'),
        'authError'=>'you have no access.',
        'authorize'=>array('Controller')
    )
);
Run Code Online (Sandbox Code Playgroud)

然后我添加了一个布局View/Pages/admin_index.ctp,这是我想在登录后重定向的地方.我设法让我的登录工作在UsersController.php.

所以问题是,我应该在AppController.php中重定向以将我的登录管理员转到admin_view?我相信loginRedirect以某种方式被破坏了..

我已经研究了一些关于这个主题的教程,但我发现只有这个Youtube视频http://www.youtube.com/watch?v=zvwQGZ1BxdM所有其他教程似乎都与早期版本的CakePHP有关.

php cakephp

11
推荐指数
1
解决办法
7642
查看次数

如何在CakePHP中加载Google字体/在CakePHP 2.3.6中使用GoogleFontHelper

如何在CakePHP中加载Google字体?我找到了一个为CakePHP 2.0构建的帮助器.它在这里:http://plugins.cakephp.org/p/1277-CakePHP-Font-Plugin

但是当我尝试使用它将它集成到我的AppController中时:

public $helpers = array('Session','Html', 'Js', 'Form', 'GoogleFont');
Run Code Online (Sandbox Code Playgroud)

,结果是:

Strict (2048): Declaration of GoogleFontHelper::url() should be compatible with Helper::url($url = NULL, $full = false) [APP/View/Helper/GoogleFontHelper.php, line 50]
Run Code Online (Sandbox Code Playgroud)

那么这个GoogleFontHelper与CakePHP 2.3.6不兼容.

或者是否有另一种加载Google字体的方法?

cakephp

1
推荐指数
1
解决办法
2463
查看次数

标签 统计

cakephp ×2

php ×1