using template in a loop
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #3
RE: using template in a loop
(04-19-2011 02:42 PM)ZiNgA BuRgA Wrote:  Of course, because you're using =, you're overwriting the variable on each loop cycle.
Consider

PHP Code:
$a = 1;
$a = 2;

The first line may as well not be there because it's overwritten by the second.

You probably want to use the string concatenation operator (.=) not the assign operator (=).

I knew that the value is getting overwritten but not sure how to solve it.

Using (.=) in eva ("\$group_bit .= \"".$templates->get("social_group_bit")."\";"); worked nicely..

Thanks..

[Image: banner.png]
04-19-2011 04:44 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
using template in a loop - techu - 04-19-2011, 01:16 PM
RE: using template in a loop - ZiNgA BuRgA - 04-19-2011, 02:42 PM
RE: using template in a loop - techu - 04-19-2011 04:44 PM

 Standard Tools
Forum Jump: