[[$ChunkName:isloggedin:is=`1`:then=`[[$LoggedInChunk]]`:else=`[[$NotLoggedInChunk]]`]]
[[NoElement:isloggedin:is=`1`:then=`[[$LoggedInChunk]]`:else=`[[$NotLoggedInChunk]]`]] [[NoElement:userinfo=`email`]]
[[-:isloggedin:is=`1`:then=`[[$LoggedInChunk]]`:else=`[[$NotLoggedInChunk]]`]] [[-:userinfo=`email`]]
[[`Ham & Eggs`:htmlent]]
[[-'Ham & Eggs':htmlent]]
[[SnippetName? &user=`[[-:userinfo:username]]`]]
IMO, this defeats the modularity of the parser. Having each element class have an implementation that is only loaded on demand keeps the parsing code lean and efficient. Having literals or non-element implementations would add overhead to every request, and every parsing cycle within that request, and to be honest, I’m looking harder for ways to improve efficiency and simplify the code. And why not just use the If snippet for conditionals (I will never recommend using filters as conditionals) or write your own quick conditional snippet for those cases?
Sorry, I thought I had published it for the team previously; my mistake. But it’s basically just a simple script I call "If". Here it is for now; I’ll put it in the Extras repo later today...
I’m not sure what you mean by "the if snippet." Have I missed something?
<?php
/* simple if (conditional) snippet */
$output = '';
$operator = !empty($operator) ? $operator : '';
$operand = !isset($operand) ? '' : $operand;
if (isset($subject)) {
if (!empty($operator)) {
switch ($operator) {
case '!=':
case 'NEQ':
case 'neq':
case 'ISNOT':
case 'isnot':
case 'ISNT':
case 'isnt':
$output = (($subject != $operand) ? $then : (isset($else) ? $else : ''));
break;
case '<':
case 'LT':
case 'lt':
$output = (($subject < $operand) ? $then : (isset($else) ? $else : ''));
break;
case '>':
case 'GT':
case 'gt':
$output = (($subject > $operand) ? $then : (isset($else) ? $else : ''));
break;
case '<=':
case 'LTE':
case 'lte':
$output = (($subject < $operand) ? $then : (isset($else) ? $else : ''));
break;
case '>=':
case 'GTE':
case 'gte':
$output = (($subject > $operand) ? $then : (isset($else) ? $else : ''));
break;
case 'empty':
case 'EMPTY':
$output = (empty($subject) ? $then : (isset($else) ? $else : ''));
break;
case '!empty':
case '!EMPTY':
case 'notempty':
case 'NOTEMPTY':
$output = (!empty($subject) ? $then : (isset($else) ? $else : ''));
break;
default:
$output = (($subject == $operand) ? $then : (isset($else) ? $else : ''));
break;
}
}
}
return $output;
?>I will try to get it in there soon.
Jason, have u put this in the Repo yet?
[+phx:userinfo=`username`+]
They can create a ’phx’ snippet that does nothing if they need this I guess, but I don’t see the point of this and never have. This kind of stuff should be a snippet anyway; not exactly a modifier IMO.
One more comment on elementless tags: In PHX, adding the PHX: prefix allows tags with no element like this:
[+phx:userinfo=`username`+]
People may have trouble translating these for Revo (unless I’m missing something).