Digging through the code, it looks like the template logic is implemented by Varien_Filter_Template
(under lib\Varien not app\code) in the filter
function which issues a callback to the ifDirective
function if the pattern matches the regex. The ifDirective
in turn uses the _getVariable
function to evaluate your if
condition. _getVariable
then tokenizes the condition in Varien_Filter_Template_Tokenizer_Variable
into either a property or a method.
if($this->isWhiteSpace()) {
// Ignore white spaces
continue;
} else if($this->char()!='.' && $this->char()!='(') {
// Property or method name
$parameterName .= $this->char();
} else if($this->char()=='(') {
// Method declaration
$methodArgs = $this->getMethodArgs();
$actions[] = array('type'=>'method',
'name'=>$parameterName,
'args'=>$methodArgs);
$parameterName = '';
} else if($parameterName!='') {
// Property or variable declaration
if($variableSet) {
$actions[] = array('type'=>'property',
'name'=>$parameterName);
} else {
$variableSet = true;
$actions[] = array('type'=>'variable',
'name'=>$parameterName);
}
$parameterName = '';
}
When the if condition is detected to be a method, it will execute that method, otherwise it simply returns the string value of the variable.
All of which means (I think!) that if you want to evaluate an expression inside the if statement, you need to add a new customer attribute (there are extensions available for this) that the template can evaluate. So if you define a boolean "isMemberOfGroupNameX" attribute, then the template should work.
I imagine this is not the answer that you're looking for, but I'm fairly sure that's the case.
HTH,
JD