Re: [Cheetahtemplate-discuss] How do I emulate Smarty's include mechanism?
Brought to you by:
rtyler,
tavis_rudd
From: Tavis R. <ta...@re...> - 2004-03-08 21:54:03
|
just use: #include $templateFileName On Monday 08 March 2004 13:06, Shannon --jj Behrens wrote: > --- William Dode <wi...@fl...> wrote: > > Shannon --jj Behrens <jj...@ya...> writes: > > >> I did my own "run_template" function who take care of the context, > > >> the > > >> compilation and caching. So your example become for me : > > >> #for ... > > >> $run_template($context, $item...) > > >> #end for > > > > > > I did this as well in Aquarium. I'm curious, how did you take care > > > > of > > > > > automatically compiling base classes? > > > > I've a script who compare the last modification time of the template > > with the generated .py. After this, i import the template and keep it > > in > > memory to can use it with differents values. > > > > Notice that it's important to begin all the templates with "#filter > > none", because it will not be initialised each time. > > I'm sorry, I should have been more specific. I want to do a dynamic > import of a template class. That means that I don't know the class's > name until runtime. This is easy to take care of with a special > function, which I call aquariumImport (it takes care of compiling if > necessary and importing). This works, and is similar to what you have > done. However, what if that template has a base class? I need to have > that base class template automatically compiled or recompiled if > necessary. However, aside from hooking __import__ or doing other > equally untasty things, I can't figure out how to do this since the > Cheetah template's "#extends" gets compiled down to something like > "from aquarium.layout.CssAndJavaScript import CssAndJavaScript"--i.e. > there's nothing I can "hook". > > Thanks, > -jj > > __________________________________ > Do you Yahoo!? > Yahoo! Search - Find what you=92re looking for faster > http://search.yahoo.com > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > _______________________________________________ > Cheetahtemplate-discuss mailing list > Che...@li... > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss |