开发者

Outputting an HTML entity character from a helper function

开发者 https://www.devze.com 2022-12-28 15:36 出处:网络
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 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?


"&#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 ?>.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号