开发者

Does Zend have something like {strip} in Smarty?

Smarty has a {strip} function:

{strip}
<开发者_如何学运维table border='0'>
 <tr>
  <td>
   Hello world
  </td>
 </tr>
</table>
{/strip}

Which outputs:

<table border='0'><tr><td>Hello world</td></tr></table>

I also want to do this in Zend (to reduce the amount of bites send on each request), without installing Smarty.

However, I don't want to add code to every Layout / .phtml file, so a frontcontroller plugin would be nice.


Why not just use the same regex that Smarty uses. It's quite simple:

function strip($str, $replace = ' ')
{
    return preg_replace('#\s+#', $replace, $str);
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜