Re: [SMARTY] Using Javascript to Call Smarty?
| From: | Monte Ohrt | Date: | Wed, 12 May 2004 15:26:15 +0000 |
| Subject: | Re: [SMARTY] Using Javascript to Call Smarty? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11383@lists.php.net to get a copy of this message | ||
Escape your javascript curly braces with {ldelim} and {rdelim} (get rid of the {literal}{/literal} tags)
Then your {include ...} should work.
Sarah Gray wrote:
Hi -- I have to include a smarty template from within another smarty template based on whether or not a javascript cookie is read (to see if the user is logged in or not). All is fine when I read the cookie. However, I tried to document.write('{include file="template.tpl"}') if the cookie was there, and it just wrote the line of text -- {include file="template.tpl"} -- on the page but did not execute it (ie, did not actually include the file). I included the javascript in {literal} tags -- which may be part of the problem. Then I tried leaving the {include file="template.tpl"} block outside of the literal tags, but then it got included regardless of whether the cookie was there. I thought maybe I would use document.write in the included template -- to render the tables: but I have smarty variables in those as well so I think I would run into the same issue as above. My question is, is there any way to use Javascript in this way? Thanks, s.