[Solar-talk] html formatting and escape()

Paul M Jones pmjones at solarphp.com
Mon Jul 3 13:38:26 PDT 2006


Hi Jeff,

> When I look at your escape function you are only using  
> htmlspecialchars() so
> if I echo $this->escape($item['description']) and variable
> $item['description'] contains the string "<a href='test'>Test</a>"  
> it should
> return something like &lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;
>
> But it does not, it only returns nicely escaped text "<a  
> href='test'>Test</a>"
>
> Am I missing something here?

That's strange.  I just ran this quick script ...

<?php
require_once 'Solar.php';
Solar::start(false);

$html = "<a href='test'>Test</a>";
$view = Solar::factory('Solar_View');
echo $view->escape($html);

Solar::stop();
?>

... and the output (in browser source) is in fact "&lt;a  
href='test'&gt;Test&lt;/a&gt;" which is the way it should be.

Have I missed the point of your question?


--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.   <http://solarphp.com>

Savant: The simple, elegant, and powerful solution for
templates in PHP.   <http://phpsavant.com>




More information about the solar-talk mailing list