Passing a Smarty variable into Javascript link "src" attribute
Posted
by mikemick
on Stack Overflow
See other posts from Stack Overflow
or by mikemick
Published on 2010-03-26T17:59:25Z
Indexed on
2010/03/26
18:03 UTC
Read the original article
Hit count: 210
smarty
|JavaScript
I've assigned a Smarty variable:
{assign var="siteurl" value="http://website.com"}
I can successfully use it in my header.html file to call a CSS link:
<link rel="stylesheet" type="text/css" href="{$siteurl}/style.css" />
displays
<link rel="stylesheet" type="text/css" href="http://website.com/style.css" />
However, when I do the same for a Javascript source, it literally prints out "{$siteurl}":
<script type="text/javascript" src="{$siteurl}/scripts.js"></script>
displays
<script type="text/javascript" src="{$siteurl}/scripts.js"></script>
Why isn't this Smarty variable displaying as expected?
© Stack Overflow or respective owner