[geeklog-devel] JavaScript, Template Variables and Autotags

Tom websitemaster at cogeco.net
Sun Mar 20 10:35:29 EDT 2011


Does anyone see the need for our template engine to be searching for
template variables in JavaScript? I have run into a problem where curly
brackets are used in JavaScript code and then our template engine is
stripping them out when nothing was found matching it.

Since we introduced autotags to templates this problem also happens with
autotags. If an autotag is listed in JavaScript (for example in alert
message box as a help message or something) if found the autotag will be
replaced. To fix this problem for now I have disabled autotags in the footer
template file (that is where by default JavaScript goes in the scripts
class).

For template variables I think we should at least disable removing of unused
template variables in the footer

This can be easily done in COM_siteFooter by adding the line

$footer->unknowns = 'keep';

These 2 fixes  are temporarily since it doesn't fix the entire problem.
JavaScript could appear in other template files. I think  ideally we would
want template variables and autotags to remain as is, if found in any
JavaScript code (ie between <script type="text/javascript"> and </script>).
I am not sure if I have the time to fix this right now before 1.8.0 release.


Thoughts?

Tom




More information about the geeklog-devel mailing list