|
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 |
Tuplad Smarty n00b
Joined: 13 May 2011 Posts: 3
|
Posted: Thu Jun 23, 2011 2:34 pm Post subject: Two identical for each loops don't work together |
|
|
No error, nothing... the second just doesn't show up. What to do ?
clubs.tpl : http://pastebin.com/UQNHCpib
clubs.php : http://pastebin.com/G1YTCyM7
I'd find it stupid to rewrite the same piece of code but with an other varname, anyone knows what's going on ? |
|
Back to top |
|
rodneyrehm Administrator
Joined: 30 Mar 2007 Posts: 674 Location: Germany, border to Switzerland
|
Posted: Thu Jun 23, 2011 3:53 pm Post subject: |
|
|
change
Code: | $smarty->assign('prov', $prov); |
to
Code: | $smarty->assign('prov', $prov->fetchAll()); |
and you'll assign an array that can be iterated twice. The PDOStatement cannot, as there is no way to reset the cursor.
besides that, are you sure you know what you're doing setting PDO::FETCH_LAZY? Read carefully:
Quote: | Specifies that the fetch method shall return each row as an object with variable names that correspond to the column names returned in the result set. PDO::FETCH_LAZY creates the object variable names as they are accessed. |
so some object should be created, nothing wrong with that. But why are you treating it as an array in your templates? there's no, absolutely no, benefit from this. |
|
Back to top |
|
Tuplad Smarty n00b
Joined: 13 May 2011 Posts: 3
|
Posted: Sat Jun 25, 2011 11:30 am Post subject: |
|
|
Thanks a lot, globe!
To be honest, I didn't really know what I was doing with LAZY, I've removed it! |
|
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
|