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
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?
We use the following pattern:
<script src="{$page.cdn}prototype.js" type="text/javascript></script>
Where $page contains information that changes based on the environment.
Development server:
$page.cdn = /resources/
Production server:
$page.cdn = http://cdn.domain.com/app
精彩评论