[albatross-users] Two questions (client-side production of static pages)

Andrew McNamara andrewm at object-craft.com.au
Wed Jul 3 10:10:30 EST 2002


>Regarding the second point, (nested macros), this scheme suggested by
>Dave Cole works great for me:
>
>> master.html:
>> 
>>     <al-macro name="master">
>>       <al-usearg name="sidebar">
>>       Stuff stuff stuff
>>       <al-usearg name="body">
>>       Blah blah blah
>>     </al-macro>
>> 
>> somepage.html:
>> 
>>     <al-expand name="master">
>>     <al-setarg name="sidebar">
>>      <al-expand name="sidebar-with-bells-on"/>
>>     </al-setarg>
>>     <al-setarg name="body">
>>         Foo bar, foo bar, foo bar...
>>     </al-setarg>
>>     </al-expand>
>
>I just had to modify my "site builder" scripts to read in all the
>templates from a certain directory, rather than just master.html (so
>it picks up sidebar-with-bells-on.html, etc.) - so now I have one
>directory of "utility" templates, seperate from the rest of my
>templates.

Yes, currently my script does a load_templates() and to_html() on
all the files in a "templates" sub-directory, before processing the
directory itself.

Looking at the internals of Albatross, however, I realised that it would
be possible, with a small change, to register the macros at load time;
this allows you to first load_template() all the files in a directory,
without caring if they contain macros or not, then do the to_html()
on each.  It also means, within a given file, that you can use a template
before it is defined.

The downside is that you have a whole directory worth of template objects
in memory at a time, rather than just one file and associated macros.

Dave also thinks this is reasonable, so it should appear in the next
Albatross release.

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



More information about the Albatross-users mailing list