|
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 |
BenFromTokyo Smarty Rookie
Joined: 15 Oct 2004 Posts: 12 Location: Japan
|
Posted: Sat Feb 26, 2005 6:13 am Post subject: table_foreach |
|
|
[Answer to a question about table_foreach]:
Hi,
I did some test on my side and the code :
Code: |
<?php
require_once("Smarty.class.php");
$smarty = new Smarty();
$smarty->compile_dir = '../../inc/smarty/templates_c/';
$smarty->template_dir = './';
$images[]["image_small"] = "1.jpg";
$images[]["image_small"] = "2.jpg";
$images[]["image_small"] = "3.jpg";
$images[]["image_small"] = "4.jpg";
$images[]["image_small"] = "5.jpg";
$images[]["image_small"] = "6.jpg";
$images[]["image_small"] = "7.jpg";
$images[]["image_small"] = "8.jpg";
$images[]["image_small"] = "9.jpg";
$smarty->assign("images", $images);
$smarty->display('index.tpl');
?> |
with the template
Code: |
{table_foreach from=$images item=image cols=4}
<img src="{$image.image_small}" />
{/table_foreach}
|
gives me the expected result:
Code: |
<table border="1">
<tr>
<td> <img src="1.jpg" />
</td>
<td> <img src="2.jpg" />
</td>
<td> <img src="3.jpg" />
</td>
<td> <img src="4.jpg" />
</td>
</tr>
<tr>
<td> <img src="5.jpg" />
</td>
<td> <img src="6.jpg" />
</td>
<td> <img src="7.jpg" />
</td>
<td> <img src="8.jpg" />
</td>
</tr>
<tr>
<td> <img src="9.jpg" />
</td>
<td>&</td>
<td>&</td>
<td>&</td>
</tr>
</table>
|
Are you sure you copied the plugin in the proper directory, with the file name 'block.table_foreach.php' ?
What versions of php / smarty do you use ? _________________ Ben |
|
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
|