【发布时间】:2014-12-22 23:54:42
【问题描述】:
我的导航位于默认布局的标题中。我正在尝试设置一个导航按钮以重定向到主页上的特定 div ()。 我有这个,它不起作用:
<li> <?php
echo $this->Html->link(
'ABOUT',
array('controller'=>'pages', 'action'=>'display','home'),
array('id' => 'about_page'),
array('escape' => FALSE)); ?> </li>
这个页面控制器只接受参数并重定向到特定页面。它看起来像这样:
public function display() {
$path = func_get_args();
$page = $path[0];
$count = count($path);
if (!$count) {
return $this->redirect('/');
}
$page = $subpage = $title_for_layout = null;
if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title_for_layout = Inflector::humanize($path[$count - 1]);
}
$this->set(compact('page', 'subpage', 'title_for_layout'));
try {
$this->render(implode('/', $path));
} catch (MissingViewException $e) {
if (Configure::read('debug')) {
throw $e;
}
throw new NotFoundException();
}
}
有人可以帮帮我吗?使用渲染或重定向方法可能更容易重定向吗?
【问题讨论】:
标签: cakephp redirect hyperlink render helpers