[albatross-users] Dynamic question

Dave Cole djc at object-craft.com.au
Wed Oct 30 10:34:13 EST 2002


> Hi all,
> I have a question.
> 
> My question is:
> Can you dynamically set the name of a macro ?
> 
> Say I have a boilerplate template like so
> 
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <HTML>
> 
> <TITLE>Application - <al-usearg name='title'></TITLE>
> 
> <LINK rel=stylesheet href="/newweb.css" type=text/css
> title="/newweb.css">
> </HEAD>
> <BODY>
> <BR><BR>
> <SPAN class="header1"><al-usearg name='title'></SPAN>
> 
> <BR>
> <SPAN class="header2"><al-usearg name='timedate'></SPAN>
> <HR>
> 
> <al-expand name='whatever'>
> 
> <BR><BR>
> 
> </BODY> </HTML>
> 
> If I wanted the "whatever" to be different depending on a value in
> my Python program, is that possible ?

Yes and no.  You can't be fully dynamic but you can get close.

  <al-value name="expand_this" lookup="macro_table">

Then have a lookup table which looks like this:

  <al-lookup name="macro_table">
   <al-item expr="this">
    <al-expand name="this"/>
   </al-item>
   <al-item expr="that">
    <al-expand name="that"/>
   </al-item>
  </al-lookup>

To use this in your code you would just set ctx.locals.expand_this to
either 'this or 'that'.

- Dave

-- 
http://www.object-craft.com.au




More information about the Albatross-users mailing list