Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Changing existing variable value in template

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
srini_Vk
Smarty n00b


Joined: 29 Jun 2007
Posts: 2

PostPosted: Fri Jun 29, 2007 12:56 am    Post subject: Changing existing variable value in template Reply with quote

I have a variable called {$shipping.rate}.

I would like to change its value to 100. None of the following is worked:
1. {$shipping.rate=100}
2. {assign $shipping.rate=100}
3. {assign var=$shipping.rate value=100}

How do I change this.
Back to top
View user's profile Send private message
shannera
Administrator


Joined: 13 Feb 2006
Posts: 802
Location: Edertal, Germany

PostPosted: Fri Jun 29, 2007 8:07 am    Post subject: Reply with quote

See http://www.phpinsider.com/smarty-forum/viewtopic.php?t=7201&highlight=create+array for a way to assign values to elements of an array.
Back to top
View user's profile Send private message
srini_Vk
Smarty n00b


Joined: 29 Jun 2007
Posts: 2

PostPosted: Fri Jun 29, 2007 10:57 am    Post subject: Reply with quote

Hi,

I'm very new to smarty. Mine is just a variable not an array. Can you tell me how to change its value.

Thanks,
Back to top
View user's profile Send private message
Celeb
Administrator


Joined: 17 Apr 2007
Posts: 1025
Location: Vienna

PostPosted: Fri Jun 29, 2007 11:27 am    Post subject: Reply with quote

$shipping.rate is not just a Variable. $shipping is an Array and you seem to want to change it's item indexed by 'rate'.

You're gonna have to go with shannera's solution.
_________________
Darn computers always do what I tell them to instead of what I want them to do.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP