Jump to content

Menz

Members
  • Posts

    1
  • Joined

  • Last visited

Menz's Achievements

Starter

Starter (1/6)

0

Reputation

  1. Hi Wanze, first of all a big thank you for this great module which I stumbled upon a few days ago. I also have some questions regarding the flexibility of TemplateEngineFactory. Let me explain what I was trying to achieve (using Smarty, but I think this would apply to other template engines as well): In a page of mine, there is a specific template whose output should be processed by a text filter before sending to the client browser. Also the processed output should be cached a specific amount of time (just output of pages based on this specific template). What I tried: attach the text filter via a new module and a hook to Page::render(). With this approach I have to be careful to just apply the filter to the one specific type of pages and also (as the filter is CPU-intensive and the hook is executed at every page view) it does not work well with caching. attach the text filter via a hook to TemplateEngineSmarty::initSmarty(). Here I also have to be careful to not apply the filter to the wrong pages, caching with Smarty works but only with one global cache timeout config value. This is not acceptable for me because this would also affect pages based on other templates. I then digged a bit in the source code of the module and had the following idea: Why not provide a so-called 'direct' mode, globally enabled/disabled via module configuration. This direct mode does not attach the hook to Page::render() and lets the user choose when to output the markup via a method like $view->renderAndPrint(). Wouldn't ths also give back the possibility to control caching time per template via the template caching configuration? Also filters could be added right in the template source file before calling $view->renderAndPrint(). I am not sure If I thought this through entirely and not missed something and would appreciate any feedback on my suggestion. Thank you in advance, Menz
×
×
  • Create New...