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

 
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 -> General
View previous topic :: View next topic  
Author Message
cubee
Smarty n00b


Joined: 16 Dec 2004
Posts: 2

PostPosted: Thu Dec 16, 2004 10:37 pm    Post subject: foreach Reply with quote

Hi

I have a problem with foreach. When I write in template:
Code:

{foreach from=$blocks_page_1 item=curr}
    {$curr}<br>
{/foreach}

PHP return me:
Code:

Warning: preg_match() expects parameter 2 to be string, array given in xxx/smarty/Smarty_Compiler.class.php on line 1506

Fatal error: Smarty error: [in xxx/templates/index.tpl line 61]: syntax error: invalid attribute name: 'Array' (Smarty_Compiler.class.php, line 1510) in xxx/smarty/Smarty.class.php on line 1088

When I delete this line, all is ok.

Any ideas?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Dec 16, 2004 10:58 pm    Post subject: Reply with quote

is $blocks_page_1 an array?
Back to top
View user's profile Send private message Visit poster's website
cubee
Smarty n00b


Joined: 16 Dec 2004
Posts: 2

PostPosted: Fri Dec 17, 2004 12:57 pm    Post subject: Reply with quote

I've fixed this problem, but now I have a problem with:
Code:

line 76: {include file="test.tpl"}

Code:

Warning: preg_match() expects parameter 2 to be string, array given in /home/maresca1/public_html/libs/smarty/Smarty_Compiler.class.php on line 1506

Fatal error: Smarty error: [in /xxx/templates/index.tpl line 76]: syntax error: invalid attribute name: 'Array' (Smarty_Compiler.class.php, line 1510) in /xxx/libs/smarty/Smarty.class.php on line 1088


I've started receiving this problems when admin changed php to 4.3.10, and I changed Smarty to 2.6.6.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Dec 17, 2004 2:28 pm    Post subject: Reply with quote

Be sure to clear out your compile and cache files, and if you're using a PHP accelerator clear its files as well.
Back to top
View user's profile Send private message Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Dec 17, 2004 3:29 pm    Post subject: Reply with quote

php-4.3.10 triggers a bug in zend_optimizer that breaks php's foreach.
to me it looks you are bitten by that. upgrade zend-optimizer.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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 -> General 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