View Single Post
  #8 (permalink)  
Old 08-20-08, 12:16 PM
Hamed Hamed is offline
Wannabe Coder
 
Join Date: Jan 2007
Posts: 188
Thanks: 2
Thanked 0 Times in 0 Posts
Thanks about this code it works well but it has one problem when I use ' or " in my conditions I will get
Code:
Warning: Unexpected character in input: ''' (ASCII=39) state=1 in C:\xampp\htdocs\Rose\inc\template.class.php(34) : regexp code on line 1
is there any way to slove it or no I can not use ' or "
and one more thing when I use two vars in condition, condetion become ture although it is false.
PHP Code:

$code preg_replace("~\{if ([^\}]+)\}(.*?)((:?\{else\})(.*?))?\{/if\}~sie"'($1 ? "$2" : ("$5" ? "$5" : null))'$code); 

Reply With Quote