hi there
just wanted to share this little global macro since the feature was requested so many times (and i was one of its rather passionate opponents :) and it's now possible to do it with helma 1.6:
// <% if <% macro %> is "value" then "yes" else "no" %>
// <% if <% macro1 %> is "value" then <% macro2 %> else <% macro3 %> %>
var if_macro = function(param, value1, _is_, value2, _then_, thenStatement, _else_, elseStatement) {
return (("" + value1) == ("" + value2)) ? thenStatement : elseStatement;
};
of course it lacks any syntax checking, but that's probably pretty trivial to add.
(a minor drawback, though i am not sure about it: i think in the second example all three macros will be evaluated -- which would be a waste of resources. thus, the macro probably is only applicaple in a development scenario for quick testing etc.)
ciao,
tobi
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.