[Phplib-users] template blocks and C comments
Brought to you by:
nhruby,
richardarcher
|
From: Donncha O C. <don...@tr...> - 2002-05-17 11:41:39
|
I hacked the set_block() function to support /* and */ to define a block.= =20 Here's the patch, very simple, but I hadn't looked at the preg stuff in a= =20 while so if anyone has a better idea please post it. Note also that I had= to=20 change where the "Content" is grabbed from.=20 This was done to work around this Mozilla bug with html comments in texta= reas. http://bugzilla.mozilla.org/show_bug.cgi?id=3D133044 Donncha. PS. this is for the file: $Id: template.inc,v 1.5 2000/07/12 18:22:35 kk = Exp $ --- /home/www/include/template.inc Fri May 17 12:34:35 2002 +++ template.inc Fri May 17 12:34:30 2002 @@ -104,10 +104,11 @@ $name =3D $handle; =20 $str =3D $this->get_var($parent); - $reg =3D "/<!--\s+BEGIN $handle\s+-->(.*)\n\s*<!--\s+END $handle\s+-= ->/sm"; + $reg =3D "/(<!--|\/\*)\s+BEGIN=20 $handle\s+(-->|\*\/)(.*)\n\s*(<!--|\/\*)\s+END $handle\s+(-->|\*\/)/sm"; preg_match_all($reg, $str, $m); $str =3D preg_replace($reg, "{" . "$name}", $str); - $this->set_var($handle, $m[1][0]); + $this->set_var($handle, $m[3][0]); $this->set_var($parent, $str); } |