|
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 |
gerrit1900 Smarty Rookie
Joined: 10 Dec 2003 Posts: 8
|
Posted: Wed Dec 10, 2003 12:39 pm Post subject: php array |
|
|
Hy.
Ive want to use the section loop function of smarty.
Like: $smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
But if you don't know how many values u got in youre $array[]. How can you make a loop ore something to realise that?
this: $smarty->assign("LastName",array($array[]));
does not work ofcourse...
Sow how do i create a loop? |
|
Back to top |
|
Gerald Smarty Regular
Joined: 26 Nov 2003 Posts: 53 Location: Lyon [France]
|
Posted: Wed Dec 10, 2003 12:59 pm Post subject: |
|
|
My favorite instruction to loop through an array will be:
Code: |
{foreach from=$yourArray item=theValue key=theKey}
Shows the key: {$theKey}
Shows the value: {$theValue}
{/foreach}
|
|
|
Back to top |
|
gerrit1900 Smarty Rookie
Joined: 10 Dec 2003 Posts: 8
|
Posted: Wed Dec 10, 2003 1:10 pm Post subject: |
|
|
tnx that works. Men i don't know it was so simple!
Tnx G. |
|
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
|