plger wrote:
It should be triggered right before a page is compiled (it's registered with the ContentPreCompile event).
The event ContentPreCompile is called only if the
page content is not cached. I have tested the event with UDT:
Code: Select all
echo '<h1>ContentPreCompile<h1>';
exit;
The UDT ist executed in 3 cases:
1. If the global cache is cleared.
2. If the page is defined as not cachable.
3. If the page content has been recently changed and not yet compiled.
If the
page content (not the templates) is cached the event does not seem to be triggered.
plger wrote:
But after using the module for a while, I found out that on some setups both variables seemed to be empty when used in the template. I first thought that the event wasn't triggered or I didn't use it correctly, so I tried manually adding {babel action="assign"} at the beginning of my templates. However, this did not solve all problems, and after some tests I realized that $page_lang was available at the beginning of the template, but not always at the end...
The variable $page_lang will not be recreated or reassigned until one of the 3 cases listed above occur on this page.
Changing templates does not help, as the event ContentPreCompile is triggered only with the tag {content} and consider only changes made to the content part not the entire page.
plger wrote:
I remember reading somewhere that templates were processed in two parts (head and the rest) - if that's true, than maybe it's the source of the problem.
It's true. See the config.php
Code: Select all
# In versions of CMS Made Simple prior to version 1.4, the page template was processed
# in it's entirety. This behaviour was later changed to process the head portion of the
# page template after the body. If you are working with a highly configured site that
# relies significantly on the old order of smarty processing, you may want to try
# setting this parameter to false.
$config['process_whole_template'] = false;
plger wrote:
In any case, I found out that if I called {babel action="assign"} just after the tag, I never had any problem with it...
Because in this case you do not rely on the event and cache ;)
Unfortunately, I have no solution. Normally you would add your UDT to the event TemplatePreCompile to catch template changes. But this event seems to be never triggered
http://forum.cmsmadesimple.org/index.ph ... .msg182329