Outputting an HTML entity character from a helper function
I am using Symfony 1.3.2 on Ubuntu. I have written a little helper function (statsfoo) that prints out sum开发者_JAVA百科mary 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?
"♦"
//^ remember the '#'.
Numeric character references has the form of {
or ઼
, which is to different from Character entity reference &abc;
.
(BTW, you forgot to ?>
.)
精彩评论