Re: [Phplib-users] comments in template file
Brought to you by:
nhruby,
richardarcher
|
From: Sven <Deb...@Ko...> - 2003-10-25 22:32:53
|
Hello
In my old function i can't delete comments inside comments.
For example:
{* comment A {* comment B *} *}
With this function, we can kill all comments:
/**********************************************************
* This function strip comments from templates.
*
* Returns:
*
* @param $str
* @access public
* @return string
*/
function delete_comment($str) {
$a = 1;
$b = 0;
while ($a > $b) {
$a = strlen($str);
$str = preg_replace('/(\{\*(?:[^{*]|\{(?!\*)|\*(?!\}))*\*\})/', '',
$str);
$b = strlen($str);
}
return $str;
}
--
ciao Sven
|