Categories > TinyButStrong general >

single navigation for 2 blocks

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Unni
Date: 2012-11-15
Time: 13:21

single navigation for 2 blocks

I have 2 merge blocks

$RecCnt =$TBS->MergeBlock('listprosearch', $product_display_array); // This one for product listing

$RecCnt =$TBS->MergeBlock('listcontsearch', $content_display_array);//This one for page content listing

I need a  single navigation bar for these 2 data listings within a page.

suppose product list has 10 items and content list has 50 items

If i set 30 as number of items in a page.... 10 items from product and 20 items from the contents on the first page and remaining 30 contents items on the second page...

Is this possible? please give me the guidance.. Thanks
By: Skrol29
Date: 2012-11-16
Time: 01:18

Re: single navigation for 2 blocks

Hi,

In your example, $PageNum has the same value for the navigation bar and the two data blocks for merging.
Neverthless, $PageSize and  $RecCnt are different for those 3 merges.

You have :

$PageSize_Product = 10;
$PageSize_Contents = 20;
$PageSize_NavBar = $PageSize_Product + $PageSize_Contents;

$RecCnt_Product = count($product_display_array);
$RecCnt_Contents = count( $content_display_array);
$RecCnt_NavBar = $RecCnt_Product + $RecCnt_Contents;

Then you can perform the 3 merges quite like in the TBS online example.
By: Unni
Date: 2012-11-20
Time: 15:05

Re: single navigation for 2 blocks

Hi

The two parameter values need to be changed page by page.
$PageSize_Product = 10;
$PageSize_Contents = 20;

We cant give as constant..

Suppose we  have 60 records ( in 2 data arrays)

35 are  products and  25 are contents

we set  10 as page size ( this may be varied and the site visitor has the right to set this)

So from page 1 to 3 there is only product listing
in page 4 there are 5 products and 5 contents

From page  5 onwards there are contents  only

Is this possible? Please let me know.. Thanks

By: Unni
Date: 2012-11-21
Time: 01:40

Re: single navigation for 2 blocks

Hi,

I need to accomplish a navigation bar for two data set... the whole data come from first data set  initially and then from the next
These are our two  data set

$content_display_array=array('UNNI','REMA','KANNAN','JON','LEIGH','ARCHANA','DEEPAK','JOE','ALEX','JIMMY','LAL','SHAJU','AJOY');
$Product_display_array=array('LION','TIGER','RAT','CAT','DOG','FOX','COW','MOUSE','CROW','HEN','DUCK','SNAKE');


In page 1 we need
'UNNI','REMA','KANNAN',
Page 2
'JON','LEIGH','ARCHANA'
Page 3
'DEEPAK','JOE','ALEX'
Page 4
'JIMMY','LAL','SHAJU'
Page 5
'SHAJU','AJOY','LION'
Page 6
'TIGER','RAT','CAT'

and so on

My coding is as follows
PHP

$PageSize1 = 2 ;
$PageSize1 = 1 ;
$PageSize = 3 ;

$TBS = new clsTinyButStrong ;

$TBS->LoadTemplate('left.html') ;
$TBS->PlugIn(TBS_BYPAGE,$PageSize1,$PageNum, $RecCnt);
$RecCnt1 = $TBS->MergeBlock('listcontsearch', $content_display_array) ;
$TBS->PlugIn(TBS_BYPAGE,$PageSize2,$PageNum, $RecCnt);
$RecCnt2 = $TBS->MergeBlock('listprodsearch', $Product_display_array) ;
// Merge the Navigation Bar
$TBS->PlugIn(TBS_NAVBAR,'nv','',$PageNum,$RecCnt1+$RecCnt2,$PageSize) ;

$TBS->Show(TBS_OUTPUT) ;


HTML
<table width=100% border=0>
<tr>
<td>
[listcontsearch.val][listcontsearch;block=tr]
[listprodsearch.val][listprodsearch;block=tr]</td></tr>
<tr>
  <td><!-- same code than the exemple navigation bar -->
    <div><table border="0" align="left" cellpadding="2" cellspacing="0">

        <tr align="center">

          <td><strong>Pages:</strong> </td>

    <td width="16"><a href="[var.script]?PageNum=[nv.first;endpoint;magnet=a;mtype=m+m]">|&lt;</a></td>

    <td width="16"><a href="[var.script]?PageNum=[nv.prev;endpoint;magnet=a;mtype=m+m]">&lt;</a></td>

    <td width="16"><a href="[var.script]?PageNum=[nv.page;block=td;navsize=3;navpos=centred]">[nv.page]</a></td>

    <td width="16" bgcolor="#2283BF"><strong>[nv.page;block=td;currpage]</strong></td>

    <td width="16"><a href="[var.script]?PageNum=[nv.next;endpoint;magnet=a;mtype=m+m]">&gt;</a></td>

    <td width="16"><a href="[var.script]?PageNum=[nv.last;endpoint;magnet=a;mtype=m+m]">&gt;|</a></td>

  </tr>

</table></div></td>
</tr>
</table>
By: Skrol29
Date: 2012-11-23
Time: 01:36

Re: single navigation for 2 blocks

Hi,

So why don't you simply get a union of the two arrays and merge them in one shot ?

$data = array_merge($content_display_array, $Product_display_array);
$RecCnt = $TBS->MergeBlock('listearch', $data) ;