Re: Searched: Alternative to #include returning the processed content
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Wednesday, November 26, 2008, 4:49:34 PM, Alexander Reelsen wrote: > Hello > > I am currently facing a problem, when using FreeMarker in conjunction with > the Alfresco CMS. I am writing a FreeMarker Template, which has to be > pretty fast, as there will be a lot of requests in production. To archive > this, I created a few FreeMarker tags, which cache most of the Alfresco > functionality (like loading data from alfresco into freemarker, which is > quite a performance hog). > > In order to complete my caching framework, I would like to implement some > sort of prerendering functionality, which would be significant for the > performance I guess. > > The document I am rendering consists of about 20 other documents, which > are formed as a tree, like the following one (only an example) > > - RootLevel > - L1.0 > - L1.0.1 > - L1.0.2 > - L1.1 > - L1.1.1 > - L1.2 > - L1.2.1 > - L1.2.1.1 > - L1.3 > - L1.3.1 > - L1.3.2 > - L1.3.3 > - L1.4.4 > > You get it... This is possibly unlimited depth and I am currently using > the <#include> statement to display all the tree elements as a whole tree, > which works for displaying, but not for caching, as include processes the > template, but you cannot store the output of such a processing. > > I played around with ?interpret as well, but couldn't get any useful > results either, which stored the rendered content, as you have to use the > <@interpretedVar /> notation in order the render the content (the > interpret? only creates a model if I recall correctly). > > So any hints, of how to achieve a faster inclusion of my tree based > concept would be really helpful. The most simple solution would be to have > an include, which returns the rendered text instead of processing the > argument. Is this perhaps already somewhere built-in and I just did not > find it? > > Thanks for any help and take care. Do you utilize that #include adds its variables (like it's macros) to the #includING template? If not, I guess there is nothing that prevents one to write a custom directive, like <@cached_include path/>. As a proof, the JSP caching taglibs works with FreeMarker too (through the JSP custom tag support). -- Best regards, Daniel Dekany ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/