|
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 |
thm Smarty Rookie
Joined: 09 Nov 2009 Posts: 8
|
Posted: Mon Nov 09, 2009 6:09 pm Post subject: using {function} via {include} |
|
|
Using this setup:
templates/table.tpl:
Code: | {function name=mytable}
<table>{foreach $data as $row}
<tr>{foreach $row as $column}
<td>{$column}</td>
{/foreach}</tr>
{/foreach}<table>
{/function} |
templates/index.tpl:
Code: | {include file="table.tpl"}
{mytable data=$data} |
index.php: Code: | <?php
require_once('Smarty-3.0b1/libs/Smarty.class.php');
$data=array(array(1,2), array(4,5), array(6,7));
$smarty = new Smarty;
$smarty->assign('data', $data);
$smarty->display('index.tpl');
?> |
this happens: The table data is displayed only when index.php is called for the first time. The second and all following calls, nothing is shown.
When I delete the cached templates, table data is displayed again, but again only once.
Updating to last SVN (r3321) didn't help. |
|
Back to top |
|
bdrewery Smarty n00b
Joined: 09 Nov 2009 Posts: 1
|
Posted: Mon Nov 09, 2009 6:30 pm Post subject: |
|
|
I have the same problem with caching / first load / 2nd load not showing anything. I however am not using functions in the included templates. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Nov 09, 2009 8:55 pm Post subject: |
|
|
The fix is in the SVN now |
|
Back to top |
|
thm Smarty Rookie
Joined: 09 Nov 2009 Posts: 8
|
Posted: Mon Nov 09, 2009 9:37 pm Post subject: |
|
|
U.Tews wrote: | The fix is in the SVN now |
Revision 3322 works, but 3323 shows the problem again.
As expected, setting force_compile = true also helps. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Nov 09, 2009 9:50 pm Post subject: |
|
|
could you retry please. |
|
Back to top |
|
thm Smarty Rookie
Joined: 09 Nov 2009 Posts: 8
|
Posted: Mon Nov 09, 2009 10:02 pm Post subject: |
|
|
U.Tews wrote: | could you retry please. |
Revision 3324 works, thx! |
|
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
|