【发布时间】:2010-11-28 19:35:41
【问题描述】:
我在控制器中调用了 404 页面:
$this->set('title','Page Not Found');
$this->cakeError('error404');
它使用我的自定义 404 页面,但忽略了标题。标题设置为“错误”。
你是怎么设置的?
public.ctp(我没有使用空白)
<?php header('Content-type: text/html; charset=UTF-8') ;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php echo $html->charset('utf-8'); ?>
<title><?php echo $title_for_layout?></title>
app_controller.php
function beforeRender() {
if($this->name == 'CakeError') {
$this->set('title_for_layout', 'Page Not Found');
$this->layout = 'public';
}
}
动作
$this->pageTitle = 'Page Not Found';
$this->cakeError('error404');
【问题讨论】:
标签: php cakephp cakephp-1.2