• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

want manipulate blob data

#1
Hello.
There is a need to store of multi checkbox data, so I used ARRAY_SIMPLE and TYPE_SERIALIZED in DataWriter then I have got some blob data like this;

row sample;
Code:
a:4:{i:0;s:6:"mitem1";i:1;s:6:"mitem2";i:2;s:6:"mitem3";i:3;s:6:"mitem5";}
In my view page but it won't parsed. I don't know the next step to view this value properly.
How can I manipulate this value for read in template?

Could I use <xen:if is="{ }"> statement to seperate it?
 
#3
I like your comment, but I didn't solve it completely.

At this moment, I stuck. I think there are something wrong what was lacked alot.

data from Model, serialized filed is "managecostitems".
PHP:
    $getBunyangHomelist = $this->_getBunyangHomelistModel()->getAllBunyangHomelist(
           array('bunyang_id' => $bunyangCacheId, 'areatype_id' => $areatypeId),
           array(
             'join'    =>  Happyhome_Model_ParceloutHomelist::FETCH_PARCELOUTPRICE,
             'order' => 'dong',
             'direction' => 'ASC',
             )
           );

      foreach ($getBunyangHomelist as &$Homelist) {
      // $unserializedManagecostItems2 = unserialize($Homelist['managecostitems']);
       unserialize($Homelist['managecostitems']);
      }

    $viewParams = array(
         'bunyangHomelist' => $getBunyangHomelist,
         'HomelistTotal' => $getHomelistTotal,
     );
After unserialize, I got array and shows as below;
PHP:
array(4) {
  [0] => string(6) "mitem1"
  [1] => string(6) "mitem2"
  [2] => string(6) "mitem3"
  [3] => string(6) "mitem5"
}

bool(false)

bool(false)

array(2) {
  [0] => string(6) "mitem1"
  [1] => string(6) "mitem2"
}

array(2) {
  [0] => string(6) "mitem4"
  [1] => string(6) "mitem5"
}
in templates, it just return simple array itself or the last array one element;
Code:
mitem4mitem5
HTML:
        <xen:foreach loop="$bunyangHomelist" value="$homelist">
        <tr>
          <td>{xen:raw $homelist.areatype}</td>
          <td>{xen:raw $homelist.homename} 호(號)</td>
          <!-- <td><xen:untreated>{$managecostitems}</xen:untreated></td> -->
          <td>???????</td>
          <td><span style="float: right;">
              <a href="{xen:link full:myHomeManager/edithomelist, $homelist}" class="button primary OverlayTrigger">수정</a> |
              <a href="{xen:link full:myHomeManager/deletehomelist, $homelist}" class="button required"> 삭제</a></span>
          </td>
          </tr>
        </xen:foreach>
What is the correct expression? Could I array_replace the element of array to new one? I hope doing so, but I'm not sure what is the best solution.
 
Last edited:

katsulynx

Well-known member
#4
You are required to store the return value of unserialize() back to the array.

PHP:
unserialize($Homelist['managecostitems']);
has to be

PHP:
$Homelist['managecostitems'] = unserialize($Homelist['managecostitems']);
 
#5
You are required to store the return value of unserialize() back to the array.

PHP:
unserialize($Homelist['managecostitems']);
has to be

PHP:
$Homelist['managecostitems'] = unserialize($Homelist['managecostitems']);
unfortunately it still return empty array.
 

Attachments

Last edited: