user198003
user198003

Reputation: 11151

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 to 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!

Upvotes: 0

Views: 1795

Answers (2)

Alfonso Nishikawa
Alfonso Nishikawa

Reputation: 1885

Maybe the option 'escape'=>true will be useful, like in:

$html->tag('p', $text, array('escape'=>true));

Upvotes: 0

zeroasterisk
zeroasterisk

Reputation: 2209

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/>';
}

?>

Upvotes: 1

Related Questions