Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

foreach error

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Russian
View previous topic :: View next topic  
Author Message
lomerok
Smarty n00b


Joined: 04 May 2010
Posts: 3

PostPosted: Tue May 04, 2010 8:53 pm    Post subject: foreach error Reply with quote

значит имеется вот такой массив
Array ( [0] => Array ( [0] => 1 [1] => ok.ru ) [1] => Array ( [0] => 2 [1] => google.ru ) [2] => Array ( [0] => 3 [1] => mail.ru ) )
пробую его вывести вот так
Code:

{foreach from=$testeng item=arr}
  <hr>
    {foreach from=$arr key=k item=v}
       {$k}:{$v}<br>
    {/foreach}
{/foreach}


и вот что получаю
Code:

<hr>
0:1<br>
1:ok.ru<br>
<hr>
0:2<br>
1:google.ru<br>
<hr>
0:3<br>
1:mail.ru<br>
Back to top
View user's profile Send private message
lomerok
Smarty n00b


Joined: 04 May 2010
Posts: 3

PostPosted: Tue May 04, 2010 8:54 pm    Post subject: Reply with quote

вопрос в том что за левые цифры вылазят
0:1<br>
0:2<br>
0:3<br>
Back to top
View user's profile Send private message
lomerok
Smarty n00b


Joined: 04 May 2010
Posts: 3

PostPosted: Wed May 05, 2010 7:04 am    Post subject: Reply with quote

разобрался сам ,вот код:
Code:

{foreach from=$testeng item=arr}
  <hr>
    {$arr.0}:{$arr.1}<br>
   
{/foreach}
Back to top
View user's profile Send private message
wm-prodesign
Smarty n00b


Joined: 17 Oct 2010
Posts: 1
Location: Sankt-Peterburg

PostPosted: Sun Oct 17, 2010 1:34 pm    Post subject: Reply with quote

так оне помогает вообще (
чё делать то ?
Back to top
View user's profile Send private message Visit poster's website
froch
Smarty n00b


Joined: 07 Nov 2010
Posts: 2

PostPosted: Sun Nov 07, 2010 4:21 pm    Post subject: Reply with quote

Товарищи!!! Помогите. Та же проблема.

Только проблема в том, что если выводить отдельный ключ или значение типа {$item.name},выводятся ТОЛЬКО первые символы. Как решить проблему?
Back to top
View user's profile Send private message
shini63
Smarty n00b


Joined: 19 Mar 2012
Posts: 1

PostPosted: Mon Mar 19, 2012 5:54 am    Post subject: Reply with quote

Спасибо за полезную информацию.
шины в самаре
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Russian All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP