i am trying to write a templating engine and i require a simple conditional statement to be part of it.
the syntax for the statement would go something like this:
Code: Select all
{-IF UserOnline DO 'this will be printed out! and this {-UserName-}' ''-}i just need help with the ragex part. i dont know how i would test if there is another "{-" inside it should look for two "-}" before ending the search.
so far i have this but it definatly isnt working
Code: Select all
$prepat = '([A-Za-z0-9(\<(/?[^\>]+)\>)(\{\-([A-Za-z0-9-]+)\-\})-]+)';
$pattern = '`' .$this->LEFT_DELIMITER ."\s*" ."IF" ."\s*" ."UserOnline"."\s*" ."DO" ."\s*'\s*" .$prepat ."\s*'\s*" .$this->RIGHT_DELIMITER .'`i';