Search code examples
phpjavascriptsmartycdn

How to include javascript from a CDN source using smarty


How do you include Javascript from a CDN source using Smarty? We have code such as the following for including it from a file on the web server, but I want to include it from a CDN instead.

{javascript file="prototype.js" priority=20}

When I access the Smarty documentation at http://www.smarty.net/manual/en/ "javascript" cannot be found anywhere within the page, and when I try to search the documentation the results from the following are not at all helpful: http://www.smarty.net/manual/en/search.php?query=javascript


Solution

  • Why not just include the remote .js file, using the HTML <script> tag ?

    Something like that, I suppose :

    <script 
      src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"
      type="text/javascript">
    </script>
    

    (Well, you can use another CDN than google's of course -- I took that URL as an example)


    I've never heard of that {javascript} tag for smarty; maybe it's a plugin that's been defined in your project?