简体   繁体   中英

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM