What is wrong with using plain old PHP? It is much faster and much easier.
<?php if ( $game > 4 ): ?>
some content
<?php endif ?>
If you really insist, here is a start (untested):
<?php
preg_match_all('/\{if ([^}]+)\}.+?\{\/if\}/s', $content, $matches)
foreach ( $matches as $match )
{
$expression = $match[1];
$content = preg_replace($match[0], $true ? $match[1] : '', $content);
}
?>
It's pretty simple, it gets really hairy when you want to work with nested operators.
source
share