Categories > TinyButStrong general >

Using a MergeBlock with an array of objects (OOP)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Preben Holm
Date: 2006-07-31
Time: 10:19

Using a MergeBlock with an array of objects (OOP)

How can I use a MergeBlock with an array of objects? Is that possible!


Thanks
Preben
By: Skrol29
Date: 2006-07-31
Time: 10:56

Re: Using a MergeBlock with an array of objects (OOP)

Hi,

PHP:
$TBS->MergeBlock('bz',$obj_lst);
the following is better because it access to rray by reference:
$TBS->MergeBlock('bz','array','obj_lst');

HTML:
[bz.val.my_property]

By: Preben Holm
Date: 2006-07-31
Time: 11:10

Re: Using a MergeBlock with an array of objects (OOP)

Then I get this error:

"TinyButStrong Error when merging block [product] : the data source Id 'belts' is an unsupported keyword because custom function 'tbsdb_belts_open' is not found."

PHP:
                $TBS = new clsTinyButStrong;
          $TBS->LoadTemplate('template.products.html');
          $TBS->ObjectRef =& $products->getBeltsByCollection($collection);
            $belts = $products->getBeltsByCollection($collection);
            $TBS->MergeBlock('product','array','belts');
          //$TBS->MergeBlock('product', $product);
          $TBS->Show();

HTML:
  [product;block=begin]
  <table class="product">
      <tr>
        <td class="title">Art. no.</td><td class="data">[product.val.name]</td>
        <td rowspan="5" class="description">[product.val.description_dk]</td>
    </tr>
    <tr><td class="title">St&oslash;rrelser (cm)</td><td class="data">[product.size;onformat=format_size]</td></tr>
    <tr><td class="title">Farver</td><td class="data">[product.colours; ]</td></tr>
    <tr><td class="title">[onload;if=[var.price]==1;then [var.strPrice]]</td><td class="data">[onload;if [var.price]==1;then '[product.price]']</td></tr>
    <tr><td class="title">Kvalitetskodeks</td><td class="data"><img src="./images/[product.quality;magnet=img;mtype=m*].gif" alt="" /></td></tr>
    <tr><td class="picture" colspan="3">
    <tr><td class="dots" colspan="3"></td>
    </tr>
  </table>
  [product;block=end]
By: Skrol29
Date: 2006-07-31
Time: 11:33

Re: Using a MergeBlock with an array of objects (OOP)

Hi,

The erreor message you have corresponds to a code like this:
$TBS->MergeBlock('product','belts',...);
instead of
$TBS->MergeBlock('product','array','belts');

can you doublecheck ?
By: Preben Holm
Date: 2006-07-31
Time: 11:48

Re: Using a MergeBlock with an array of objects (OOP)

Suddenly it seemed to work... maybe some apache/php cache problem!!!
Thanks anyway