By: Array in an array of objects
Date: 2012-05-02
Time: 18:09
|
See inside an array in a array of objectHi,
I want to read the content of an array in an array of objects. My code is like this : in php TBS->MergeBlock('my_array_of_object',$my_array); where $my_array is like : Array ( [0] => my_array ( [id:Proposition:private] => 123 [question_id:Proposition:private] => 293 [statement:Proposition:private] => Coca-Cola [quotation:Proposition:private] => 32 [index:Proposition:private] => A [link:Proposition:private] => javascript:poll_vote(123); [linkOFTD:Proposition:private] => javascript:pollOFTD_vote(123); [linkExternal:Proposition:private] => javascript:external_vote(123); [linkQR:Proposition:private] => javascript:qr_vote(123); [numFriend:Proposition:private] => 3 [ar_friend] => Array ( [0] => Array ( [id] => 10 [nickname] => XorCo [avatar] => Picture Object ( [name:Picture:private] => _icon_boue.jpg [title:Picture:private] => [link:Picture:private] => TEMPLATE/IMAGES/_icon_boue.jpg [width:Picture:private] => 64 [marginLeft:Picture:private] => [marginTop:Picture:private] => [height:Picture:private] => 64 [type:Picture:private] => icon [ar_default:Picture:private] => [external:Picture:private] => [thumbSizeX:Picture:private] => 64 [thumbSizeY:Picture:private] => 64 [location:Picture:private] => FILES/IMAGES/AVATARS/ [facebook:Picture:private] => ) ) [1] => Array ( [id] => 30 [nickname] => edouard.fort [avatar] => Picture Object ( [name:Picture:private] => _icon_boue.jpg [title:Picture:private] => [link:Picture:private] => TEMPLATE/IMAGES/_icon_boue.jpg [width:Picture:private] => 64 [marginLeft:Picture:private] => [marginTop:Picture:private] => [height:Picture:private] => 64 [type:Picture:private] => icon [ar_default:Picture:private] => [external:Picture:private] => [thumbSizeX:Picture:private] => 64 [thumbSizeY:Picture:private] => 64 [location:Picture:private] => FILES/IMAGES/AVATARS/ [facebook:Picture:private] => ) ) [2] => Array.... .... } As you can see there is an array in my object. So i tried this in my html : <div> [my_array_of_object;block=begin] <div>[my_array_of_object.something] and something else : [my_array_of_object.somethingElse]</div> .... <!-- Here to cross my array in my object --> [my_array_of_object.getArrayToShow;block=begin] <div> something : [my_array_of_object.getArrayToShow.something2] , and something else : [my_array_of_object.getArrayToShow.somethingelse2] </div> ... [my_array_of_object.getArrayToShow;block=end] [my_array_of_object;block=end] My problem is when i try the [my_array_of_object.getArrayToShow;block=begin] it show me : array or when i write [my_array_of_object.getArrayToShow.1.something] if show me the real ($my_array->getArrayToShow())[1]['something'] So i don't know what to do to Can you plz help me :) |
By: Skrol29
Date: 2012-05-04
Time: 01:37
|
Re: See inside an array in a array of objectHi Array,
If [my_array_of_object.getArrayToShow] is related to a sub-array and you want to merge the sub-array also, then you have to use automatic sub-blocs. See http://www.tinybutstrong.com/manual.php#html_block_subauto |