Re: [SMARTY] Setting a variable if javascript is enabled?
| From: | Jason Sweat | Date: | Wed, 12 Feb 2003 13:01:05 +0000 |
| Subject: | Re: [SMARTY] Setting a variable if javascript is enabled? | ||
| References: | 1 2 3 4 5 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7674@lists.php.net to get a copy of this message | ||
http://smarty.php.net/faq.php#18
----- Original Message -----
From: "Matthias Mohr" <MMohr@sysdesign-edv.de>
To: <smarty-general@lists.php.net>
Sent: Wednesday, February 12, 2003 6:46 AM
Subject: [SMARTY] Setting a variable if javascript is enabled?
> I need to detect in my Smarty-Templates if the browser has javascript
enabled or not.
> If javascript is enabled, I can insert javascript-variables; otherwise
not.
> I try to do something like that (smarty-delimiter are changed to "<{" and
"}>"):
> --------------------------------------------------------
> <SCRIPT>
> <{assign var="_jsenabled" value="1"}>
> var mydisp = "display:none"
> </SCRIPT>
> ...
> <UL id="name" style=<{if $_jsenabled eq
""}>&{mydisp};<{else}>"display:block;"<{/if}>>
> ...
> --------------------------------------------------------
> So I try to write
> style=&{mydisp};
> when javascript is enabled and
> style="display:block;"
> when javascript is disabled.
>
> Of course it doesn't work (Smarty will parse the script and always set
_jsenabled to "1" - right?)
>
> But what else can I do to detect either in PHP or in Smarty if Javascript
is enabled or not?
>
> with regards,
> Matthias
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>