Reputation: 1049
<?php
$this->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
$this->headTitle()->setSeparator(' - ');
$this->headTitle('Zend Framework Tutorial');
echo $this->doctype(); ?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php echo $this->headMeta(); ?>
<?php echo $this->headTitle(); ?>
</head>
<body>
<div id="content">
<h1><?php echo $this->escape($this->title); ?></h1>
<?php echo $this->layout()->content; ?>
</div>
</body>
Above code is taken from this tutorial: http://akrabat.com/wp-content/uploads/Getting-Started-with-Zend-Framework.pdf
it is on page 10, file is : zf-tutorial/application/layouts/scripts/layout.phtml
Question:
what is this line for? $this->headTitle()->setSeparator(' - ');
why we need this line: <?php echo $this->escape($this->title); ?>
I guess 'escape' is for security, but what does it actully mean here?
Upvotes: 0
Views: 115
Reputation: 4635
$this->escape()
By default, the escape() method uses the PHP htmlspecialchars() function for escaping. Escaping Output
$this->headTitle()->setSeparator(' - ');
When you add multiple values to a headtitle setSeparator
will seperate the title with the specified seperator.Head Title
<?php
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->headTitle($request->getActionName())
->headTitle($request->getControllerName());
$this->headTitle('Zend Framework');
$this->headTitle()->setSeparator(' - ');
?>
<?php echo $this->headTitle() ?>
will create <title>action - controller - Zend Framework</title>
Upvotes: 1