RE: [SMARTY] looping through array of objects not working

"A.J. Brown" <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
That did the trick!  I don't know how I missed that, Some times you just
have to have an outside eye I guess :)

Thanks,

A.J. Brown


-----Original Message-----
From: messju mohr [mailto:[email protected]] 
Sent: Thursday, November 17, 2005 3:59 PM
To: A.J. Brown
Cc: [email protected]
Subject: Re: [SMARTY] looping through array of objects not working

On Thu, Nov 17, 2005 at 03:47:00PM -0500, A.J. Brown wrote:
> Hello,
> 
> I know this was discussed earlier in the mailing list, but it is NOT
working
> for me.  I have verified that the method calls work through my
> business-logic, but I cannot us the objects in the template.  I can,
> however, use the objects when they are NOT within an array.
> 
> 
> For example, I have the following template code:
> 
> 
> ----BEGIN------------------
> 
> {foreach from="items" item="itemobj"}

{foreach from=$items item="itemobj"}

that is.

[...]
> ----END--------------------
> 
> $items contains an array of InventoryItem objects.  I've verified this
using
> print_r() in the logic just before the assign() statement is done.
> 
> The first occurrence of any method call to $itemobj (in this case,
> $itemobj->getId()) results in a "Call to a member function on a
non-object"
> fatal error.  However, if I call the method from the logic side, it works
> fine.
> 
> Also, I've verified that objects which are assigned directly (i.e. not
> within an array) are working fine.
> 
> I found a work-around to this in PHP5 using the ArrayAccess interface, but
> our server is running PHP4.4 and I do not want to have to upgrade.  
> 
> 
> I have the latest release of Smarty installed.  This particular problem is
> occurring on a windows machine (Development environment), and I have not
> tested it on the production Linux machine.
> 
> Why isn't this working?
> 
> 
> A.J. Brown
> BitNotion Technology

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.