Assuming it's Iterable, if not, use type casting first:

$res = (array) $res;

- jake

On Tue, Dec 22, 2009 at 4:46 PM, Jake McGraw <jmcgr...@gmail.com> wrote:
> foreach($res as $field => $value) {
>  $this->view->{$field} = $value;
> }
>
> On Tue, Dec 22, 2009 at 4:28 PM, Eugen_cro <eugen.bo...@tvz.hr> wrote:
>>
>> Hi all, I'm studying AjaxContent helper to stop my previous practice to just
>> echo things from controller for json responses..
>>
>> Now, I have one question:
>>
>> I have a object like this:
>> $res->rows = 1;
>> $res->columns = 2;
>>
>> Now, I pass that object to view:
>> $this->view->res = $res;
>>
>> And I get json response but with object name inside:
>> {"res":{"rows": "1", "columns":"2"}}
>>
>> How can I get rid off that "res" in my responce since I need only variables
>> that are in the object
>> {"rows": "1", "columns":"2"}
>>
>> Thx
>> --
>> View this message in context: 
>> http://n4.nabble.com/AjaxContent-tp977365p977365.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>

Reply via email to