Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Search found 3 matches
Smarty Forum Index
Author Message
  Topic: New foreach syntax
Protevis

Replies: 2
Views: 6132

PostForum: Smarty 3   Posted: Wed Sep 09, 2009 3:26 pm   Subject: New foreach syntax
Solved this problem myself on testing way Smile

So from old smarty2:
{foreach from=$fields item="field"}
{$field}
{/foreach}
To new one smarty3:
{fore ...
  Topic: New foreach syntax
Protevis

Replies: 2
Views: 6132

PostForum: Smarty 3   Posted: Wed Sep 09, 2009 3:18 pm   Subject: New foreach syntax
Well, on index.tpl tried:
{assign var=foo value=[Name, Size, Age]}

{foreach $foo as $var}
{$var}
{/foreach}

And this working good...
  Topic: New foreach syntax
Protevis

Replies: 2
Views: 6132

PostForum: Smarty 3   Posted: Wed Sep 09, 2009 2:34 pm   Subject: New foreach syntax
index.php
require('smarty/libs/Smarty.class.php');

# $smarty = new Smarty(); // for smarty2
$smarty = new Smarty; // for smarty3

$fields = array("Country", " ...
 
Page 1 of 1
All times are GMT
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP