Bug: {script} tags not being compiled correctly

If I have a {script} tag in my template block, it will only render the script in the heading when the page is actually compiling the template. However if the block is cached the {script} tag will not render.

Don’t use {script}, use the regular html tag and enclose it in {literal}

[URL]Search Results for "docsv2" | Smarty

Use the hook for scripts instead.

[quote name=‘tbirnseth’]Use the hook for scripts instead.[/QUOTE]

So call it from a hook then use the {script} tag?

There’s a standard hook called index:scripts

In that hook file (…addons/my_changes/hooks/index/scripts.post.php) use your standard html script tags and either provide a src (where broswer will cache) or your code. This way you ensure your javascript is associated with the site, not the particular page. Of course, you can enclose things in {if $controller==‘checkout’} or whatever if you need/want to conditionalize it. But if you’re using a script with ‘src’ then it’s stored in the browswer cache anyway so it’s kind of pointless to use the {script} template tag.