|
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 |
ezmil Smarty Rookie
Joined: 06 Feb 2010 Posts: 6
|
Posted: Tue Apr 27, 2010 11:31 am Post subject: vars not passed via include file in foreach |
|
|
hi,
I have a foreach containing an include file. Some dynamic vars should be passed to the included template. Doesn't seem to work ...
Code: |
{foreach $array as $value}
This is a Test: {$value.id}
<br/>
{include file="template.tpl" id=$value.id}
{/foreach}
|
In included template I try to grab {$id} and it has always the value of the last foreach iteration.
Code: |
This is the id to be shown in template.tpl: {$id}. If $array.id has values 1,2,3 $id is always 3.
|
The test-loop outside the include file is always correct.
Any ideas?
Thx, mil |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Apr 27, 2010 5:44 pm Post subject: |
|
|
I can't reproduce the problem.
You said:
If $array.id has values 1,2,3 $id is always 3.
I think you did mean $value.id, correct?
Did you use caching? |
|
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
|