[albatross-users] Re: al-macro and expr

Andrew McNamara andrewm at object-craft.com.au
Thu Apr 8 11:25:13 EST 2004


>I find myself trying to do this over and over again in albatross (for example):
>
><al-expand name="formlabel">firstName</al-expand>
>
><al-macro name="formlabel">
>    <al-if expr="custhandle.handlerErrors['<al-usearg>']">
>       <font color="red"><al-usearg></font>
>        <al-else><al-usearg></al-else>
>     </al-if>
></al-macro>
>
>Of course, this doesn't seem to work.  Is there any way to accomplish what 
>I'm trying to do?  That is, pass stuff to a macro via <al-expand> and have 
>the macro in turn pass some of those arguments to python expressions for 
>further testing.

Not currently, and I tend to agree that it would be nice. The downside
is the templating language starts to look like a programming language,
and you loose your separation between presentation and logic, and that
way lies PHP... 8-)

You might, instead, consider pushing more back into the logic (controller
in MVC terms) - something like:

    page module:
        ctx.locals.labels = ['firstName', 'whatever']

    page template:
        <al-macro name="formlabel">
         <al-if expr="custhandle.handlerErrors[label_i.value()]">
          ...
         </al-if>
        </al-macro>

        <al-for iter="label_i" expr="labels">
         <al-expand name="formlabel">
        <al-for>

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/



More information about the Albatross-users mailing list