How do you deal with special chars in template vars?
| From: | Bogien | Date: | Tue, 16 Jul 2002 20:50:49 +0000 |
| Subject: | How do you deal with special chars in template vars? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5343@lists.php.net to get a copy of this message | ||
How do you deal with special characters in template variables?
This can be annoying (lots of |htmlspecialchars):
<html>
<body>
Welcome, {$name|htmlspecialchars} {$surname|htmlspecialchars}!<br>
Here is your review: {$review|htmspecialschars}<br>
Here are the comments: {$comments|htmspecialschars}<br>
</body>
</html>
I used to store htmlspecialchars()'ed data in database, but it leads
to such conflicts:
INSERT INTO base VALUES (1, '" Henry the Great "');
SELECT FROM base WHERE name LIKE '%quot%'; <-- shouldn't find anything,
but it will