Categories > TinyButStrong general >

MergeBlock

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: df
Date: 2009-07-16
Time: 23:47

MergeBlock

I'm having trouble displaying the data in a multi-column display, serial block. There is an example for it using an array, but, I have the data in a MySQL database. I realize there is also an example for extracting from a MySQL DB, but, I can't seem to combine the two together. I want to use TBS to display my catagories, e.g.: http://www.dianfurniture.com/main/shop-furniture.php?ProductCatalogID=6.

I am using the following merge code:
$TBS->MergeBlock('bx_1,bx_2,bx_3,',$cnx_id,'SELECT Variable1, Variable2 from MyDatabase WHERE ProductCatalogID = 6') ;

I am using the sample template from serial block, just the first part, not the complex. But, I only get 1 row with all my data, it's not like the example with 3 columns and several rows.

Can anyone help me out?!!

Thanks.
By: Skrol29
Date: 2009-07-17
Time: 01:16

Re: MergeBlock

Hi DF,

The serial mode works independently of the data source. It should be the same template for Array or for MySQL.
I think the problem is in your template, can you post a snippet ?
By: df
Date: 2009-07-17
Time: 04:05

Re: MergeBlock

Hi Skrol29,

Here is the template I used. This is copied from the samples on this website where is says "Display in columns (serial)". I used the first part and deleted the second table that relates to a complex display.
======
<html>
<head>
<title>[var.title]</title>
<meta name="keywords" content="[var.keywords]" />
<meta name="description" content="Page description" />
<meta http-equiv="Content-language" content="en-us" />
</head>

<body>

<table border="1" align="center" cellpadding="2" cellspacing="0">
<tr bgcolor="#CACACA">
<td colspan="4"><div align="center"> Position / Title</div></td>
</tr>
<tr bgcolor="#F0F0F0">
<td width="10">&gt;</td>
<td width="100"><div align="center"><strong>[bx_1.ProductID]</strong><br>
<span class="text-mini">[bx_1.ProductName;block=td]</span><br>
</div></td>
<td width="100"><div align="center"><strong>[bx_2.ProductID]</strong> <br>
<span class="text-mini">[bx_2.ProductName;block=td;.]</span><br>
</div></td>
<td width="100"><div align="center"><strong>[bx_3.ProductID]</strong><br>
<span class="text-mini">[bx_3.ProductName;block=td;.]</span><br>
[bx;block=tr;serial]</div></td>
</tr>
<tr bgcolor="#F0F0F0">
<td valign="middle">&nbsp;</td>
<td colspan="2" valign="middle" class="text-mini"><font color="#666666">This line is optional</font><font color="#666666">, it enables you to<br>
define the empty cell.</font></td>
<td valign="middle" bgcolor="#E4F1E4"><div align="center">
<p><span class="text-mini">[bx_0;block=td]</span> <br>
[bx;block=tr;serial]</p>
</div></td>
</tr>
</table>


</body>
</html>
By: df
Date: 2009-07-17
Time: 04:10

Re: MergeBlock - ignore my last posting

Hi Skrol29,

Sorry, I posted the wrong version of the template. It's almost the same, but, in any case, this is what I am actually using:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>TinyButStrong</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="tbs_us_examples_0styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<p align="center" class="title-page">Example of <span class="text-prm">serial</span> parameter use<span class="text-prm"> </span></p>
<table width="500" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td><p>The <span class="text-prm">serial</span> parameter enables you to display several records in a main block. For that, you must use sub-blocks.<br>
<br>
<span class="text-section2">Example of <span class="text-prm">serial</span> parameter use for a multi-columns display:</span><br>
</p></td>
</tr>
</table>
<br>
<table border="1" align="center" cellpadding="2" cellspacing="0">
<tr bgcolor="#CACACA">
<td colspan="4"><div align="center"> Position / Title</div></td>
</tr>
<tr bgcolor="#F0F0F0">
<td width="10">&gt;</td>
<td width="100"><div align="center"><strong>[bx_1.ProductID]</strong><br>
<span class="text-mini">[bx_1.ProductName;block=td]</span><br>
</div></td>
<td width="100"><div align="center"><strong>[bx_2.ProductID]</strong> <br>
<span class="text-mini">[bx_2.ProductName;block=td;.]</span><br>
</div></td>
<td width="100"><div align="center"><strong>[bx_3.ProductID]</strong><br>
<span class="text-mini">[bx_3.ProductName;block=td;.]</span><br>
[bx;block=tr;serial]</div></td>
</tr>
<tr bgcolor="#F0F0F0">
<td valign="middle">&nbsp;</td>
<td colspan="2" valign="middle" class="text-mini"><font color="#666666">This line is optional</font><font color="#666666">, it enables you to<br>
define the empty cell.</font></td>
<td valign="middle" bgcolor="#E4F1E4"><div align="center">
<p><span class="text-mini">[bx_0;block=td]</span> <br>
[bx;block=tr;serial]</p>
</div></td>
</tr>
</table>



</body>
</html>
By: df
Date: 2009-07-17
Time: 04:15

Re: MergeBlock - test results

I forgot to mention, if you want to look at the results of my merge, this is the link:
http://test.dianfurniture.com/tbs/shop.php

Thanks.
By: TomH
Date: 2009-07-17
Time: 09:19

Re: MergeBlock


The PHP code doesn't compare to the example

Try something like...
$TBS->MergeBlock('bx,',$cnx_id,'SELECT Variable1, Variable2 from MyDatabase WHERE ProductCatalogID = 6') ;

By: df
Date: 2009-07-17
Time: 12:36

Re: MergeBlock

What??! I tried that at first, but, it didn't work!  I probably changed too many items at once.

Thanks a lot!
By: TomH
Date: 2009-07-17
Time: 21:02

Re: MergeBlock

You got it,

You're not the only one that drives down the road and bypasses the exit ramp because of doing too many things at the same time!

But you correctly did two things many newcomers fail to do
(1) you used the TBS examples as a benchmark to get at the basic functionality, and
(2) you showed us your actual code

So thanks for making it easy for others here to share their experience - and for others to be able to learn from it too.

All the best, and come back for more,
TomH