using the foreach loop:
foreach($this->text as $text) :
if ($this->escape($text->page) == $this->escape($this->id)) {
$page_id = $this->escape($text->page);
$content1 = $this->escape($text->content1);
$content2 = $this->escape($text->content2);
}
endforeach;
Then when I go to display one of the content variables like so:
<?php print $content2; ?>
It renders all of the HTML in the data as ascii. E.g., the bit of data from
mysql '<h2>Hot off the press!</h2>' is rendered in the source code as
'<h2>Hot off the press!</h2>', In other words, it renders
literally '<h2>Hot off the press!</h2>' in the web browser view.
There's no Zend_View instance being activated in my bootstrap. The
IndexController.php contains an action for the index page (which I'm testing
here) as such:
function indexAction()
{
$this->view->title = "NJAIMH: Welcome";
$this->view->id = "index";
// initialize class from application/models/Text.php
$text = new Text();
$this->view->text = $text->fetchAll();
}
in models/Text.php is just this :
class Text extends Zend_Db_Table
{
protected $_name = 'text';
}
You can see in index.phml in the first bit of code above that I'm using the
escape function. I tried removing it and it gives me an error message.
According to the documentation here:
http://framework.zend.com/manual/en/zend.view.scripts.html
I cannot escape the escape() function (haha!).
These two forum threads say that there's a default setting for escape that
uses htmlspecialchars().
http://www.nabble.com/Zend_Form-html-entities-problem-td19371128.html
I know I'm missing something obvious here, but I don't know what it is!!!
--
View this message in context: http://www.nabble.com/How-do-I-customize-the-escape%28%29-function-for-HTML-rendering--tp23283430p23293253.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论