|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
howhow Smarty Rookie
Joined: 10 Feb 2004 Posts: 6 Location: ShangHai.China
|
Posted: Wed Feb 18, 2004 2:33 am Post subject: the difference between assign and assign_by_ref? |
|
|
i found some programs based smarty alway use "assign"and"assign_by_refer".I know that they both assign
variables to a template,but what's the difference between them?
what's the condition using assign and condition using assign_by_ref?
I am not sure about that.
Can someone show me a example about them ?thank in advance! |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Wed Feb 18, 2004 10:50 am Post subject: |
|
|
Never really used assign_by_ref but judging by the name I assume it assigns a reference to the variable not the actual value which means you can do something like Code: | $blah = 1;
$smarty->assign_by_ref('blah', $blah);
$blah = 2;
$smarty->display('template.tpl'); | and have a value of 2 in your template while assign would yield a value of 1. _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
howhow Smarty Rookie
Joined: 10 Feb 2004 Posts: 6 Location: ShangHai.China
|
Posted: Thu Feb 19, 2004 3:18 am Post subject: thanks |
|
|
You mean that the value of the variable assigned by "assign_by_refer" can be changed before the template was displayed?
hmmm....I'll try it in my program..thanks |
|
Back to top |
|
|
|
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
|