htmlspecialchars
if i submit data like my string using form on insert/edit view, on a list view i'll get my string as italic (like here).
how can i avoid that, and t开发者_StackOverflow社区o have my string (with visible all html tags) on all forms?
i.e. so it appears like this: <i>my string</i>
thanks in advance!
So you're asking how you can escape the HTML code on your views when you render the results as they exist in the database... is that right?
Assuming that is what you're asking, in your view, you could simply wrap the DB field output
<?php
foreach ( $rows as $row ) {
echo $html->tag("p",htmlentities($row['Model']['field']));
}
// or more simply
foreach ( $rows as $row ) {
echo htmlentities($row['Model']['field']).'<br/>';
}
?>
Maybe the option 'escape'=>true
will be useful, like in:
$html->tag('p', $text, array('escape'=>true));
精彩评论