views:

452

answers:

2

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?

A: 

Are the script tags wrapped in a Smarty {literal}{/literal} block? That would prevent rendering of the {$siteurl} tag.

pygorex1
No. I actually, tried wrapping them with {literal} while troubleshooting, but realized that it does the opposite of what I want to do.
mikemick
You know what, I am themeing an aMember system. So, I didn't build the system from scratch. I bet they've put {literal} tags wrapping the content somewhere in the file structure. Now that I know that the above code should work, I'll start going through the file structure for debug. Thanks. Is there a possible php function that they could've called (that I should look out for) to enable this {literal} functionality?
mikemick
I tried putting {/literal} at the beginning of the script, and then {literal} at the end of the script. In case the aMember system left the {literal} tag open in one of the initial files, and closed it in one of the final files (for whatever reason). It drew an error though, so dice there either. Hmm...
mikemick
A: 

Problem Solved! As mentioned in the comments above, I am working on an aMember system. I'm not sure if they leave smarty {literal} tags open at the end of their initial files, and then close them at the end, or what. But the fix was replacing

{$siteurl}

with

{/literal}{$siteurl}{literal}

I tried putting the reverse {literal} tags at the beginning and end of the document, but it threw an error. I have to manually put the code above for each javascript src instance.

THANK YOU SO MUCH EVERYONE FOR THE HELP!!

mikemick