Javascript and {literal} tags
| From: | David Herring | Date: | Thu, 27 Jun 2002 08:41:37 +0000 |
| Subject: | Javascript and {literal} tags | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5061@lists.php.net to get a copy of this message | ||
Hi,
First post - so let me start by saying smarty has proved VERY useful to me.
Just updated to the latest smarty and changed my delimiters from double brackets, e.g "{{" and "}}" to single bracks "{" and "}".
My problems are that I have a lot of Javascript code which uses smarty template variables within it. I can go through it with lots of {literal} ...{/literal} tags to get these variables expanded - but firstly looks messy and secondly it does not work when you want to include code based upon a smarty template variable: e.g in the following javascript code how could you use literal tags correctly ?
{if $JOURNEY_ID eq ""}
if ( getSelectedValue ( form.passenger2 ) != "" )
{
if ( isNumber (form.miles2.value ) == false )
{
alert('Please ensure that the second passenger\'s miles is a valid (whole) number');
form.miles2.focus();
return;
}
}
{/if}
It's not easy for me to go back to the old delimiters as I have made a zillion edits...so any other ideas gratefully recieved.
Thanks Dave