Outputting an HTML entity character from a helper function
Posted
by morpheous
on Stack Overflow
See other posts from Stack Overflow
or by morpheous
Published on 2010-05-01T10:44:57Z
Indexed on
2010/05/01
10:47 UTC
Read the original article
Hit count: 254
I am using Symfony 1.3.2 on Ubuntu. I have written a little helper function (statsfoo) that prints out summary statistics about an item.
I am using the helper function in my template like this:
// In StatsHelper.php
<?php
function statsfoo($some_param)
{
return "<div class=\"sfoo\">&9830; the stats number for item is 42</div>"
}
//In showStatsSuccess.php
<?php use_helper(Stats);
<?php echo statsfoo($foobar, ESC_ENTITIES);
I tried both ESC_ENTITIES and ESC_RAW. In both instances, the raw number (&9830) was displayed in the page. I want to display the diamond instead.
What am I doing wrong and how can I fix this?
© Stack Overflow or respective owner