Forums / Cotonti / General / Question with caching

Trustmaster
#34504 2012-06-01 21:13

It is essential to understand how {FILE} statement works in CoTemplate. In General, CoTemplate splits work into 2 stages:

  1. Compilation of the abstract template.
  2. Parsing with the real data.

1st stage is performed once and then the results are cached. 2nd stage is performed on each and every request.

The FILE statement works on stage 1 and it works literally as #include statement works in C: it just replaces the statement with the contents of the file.

So, if you use a variable in the FILE path that changes at run-time from one request to another, then it is not going to work right for you. This is the limitation of the template engine and it is not likely to be changed any time soon for the reason of performance.

May the Source be with you!