How to include javascript file

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
pralay

How to include javascript file

Post by pralay »

Hi,
I am to include javascript file in the template......now i know that I am to write it like this
{literal}

{/literal}

Now when I am doing this inside the head tag it's ok.
But placing inside the body of the template it is producing smarty error...

string(118) "Smarty error: [in template:22 line 91]: syntax error: unrecognized tag 'literal' (Smarty_Compiler.class.php, line 583)" string(118) "Smarty error: [in template:22 line 93]: syntax error: unrecognized tag 'literal' (Smarty_Compiler.class.php, line 583)"


How can I do that? Is there a way to include js file inside the body of the template or always I have to make it included in head tag?

Please help
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: How to include javascript file

Post by tsw »

actually including js like that doesnt need {literal} tags.

literal is only needed if the content inside it has { or } characters. its smarty way of telling here starts a block you shouldnt touch. in your situtation there is only plain html and the script inclusion is done by browser...


but why you literal tag doesnt work beats me, did you check that all files are uploaded correctly and config.php has all right paths..
cyberman

Re: How to include javascript file

Post by cyberman »

Don't know if I'm right but it isn't {literal} a Smarty tag so it must allowed in config.php ?

Code: Select all

$config['use_smarty_php_tags'] = true;
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: How to include javascript file

Post by tsw »

that config is for smarty php tag {php} {/php}
cyberman

Re: How to include javascript file

Post by cyberman »

OK, thx.
Locked

Return to “CMSMS Core”