Page 1 of 1

TemplatePreCompile & TemplatePostCompile

Posted: Tue Oct 27, 2009 2:19 pm
by Sonya
I could not find any reference in core CMS Made Simple for the events:
- TemplatePostCompile
- TemplatePreCompile

I have created an UDT with just two lines:

Code: Select all

echo 'event XYZ';
exit; 
to see when these events are sent by CMS Made Simple and have assigned the UDT to the events. However, they seem not to be executed at all. Are they deprecated?

Re: TemplatePreCompile & TemplatePostCompile

Posted: Fri Feb 17, 2012 4:55 pm
by Youpi
sorry to dig up this old topic, but it is still relevant to me, on top of the fact that this event is still available in CMS MS.

Does 'TemplatePostCompile' and 'TemplatePreCompile' are really triggered ?

If yes, when ?

- when a user post a template update ?
- the first time a template is processed ?
- each time a templace is processed ?

I did't find by myself, it would help to clarify their usefulness.

Re: TemplatePreCompile & TemplatePostCompile

Posted: Fri Feb 17, 2012 5:10 pm
by calguy1000
These events are still triggered each time a template is 'compiled' from smarty code into php code.

It is executed for every page template (3 times.. once for the body, head, and top of the tempalte), for each module template, and for each GCB that is called on a particular page.

Compilation happens each time a template is changed. On a cache-able page, if all you do is change a GCB that is used on that page and hit 'reload' on a page the TemplatePreCompile event would be triggered once just for that GCB, and the TemplatePostCompile event would be triggered once.

Theoretically (and I'd have to double check this functionality) if after that you 'reloaded' a page the event would not trigger at all. Because the templates are already 'compiled'.