Re: [SMARTY] Using Javascript to Call Smarty?
| From: | David Förster | Date: | Wed, 12 May 2004 16:26:17 +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-11385@lists.php.net to get a copy of this message | ||
Hi Sarah,
I don't see any reason to use Javascript at all. You can read cookies
from php or even from the template itself.
http://lt2.php.net/manual/de/reserved.variables.php#reserved.variables.cookies
http://smarty.php.net/manual/en/language.variables.smarty.request.php
- david
On Wed, 12 May 2004 11:12:03 -0500
Sarah Gray <sarah@fabled.net> 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.
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>