views:

56

answers:

1

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?

+4  A: 
"&#9830;"
//^ remember the '#'.

Numeric character references has the form of &#123; or &#xABC;, which is to different from Character entity reference &abc;.

(BTW, you forgot to ?>.)

KennyTM
@kenny: '//^ remeber the '#'.' D'oh!
morpheous
@kenny you're not forced to close a php tag if there's not html involved after, and that will prevent having unwanted trailing spaces or CR being sent with headers
NiKo