I have a 404 page call in the controller:
$this->set('title','Page Not Found');
$this->cakeError('error404');
It uses my own 404 page, but ignores the title. The header is set to Error.
How do you install it?
public.ctp (I do not use empty)
<?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';
}
}
act
$this->pageTitle = 'Page Not Found';
$this->cakeError('error404');
source
share