Categories > TinyButStrong general >

navigation and or pagination

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: joe
Date: 2006-07-08
Time: 22:48

navigation and or pagination

I'm having trouble getting one of these to work with the new version of TBS.

I have a left frame and a right frame, I would like the nav to work in the left frame. 

<table border="0" align="left" cellpadding="2" cellspacing="0">

        <tr align="center">

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

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

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

    <td width="16"><a href="[var..script_name]?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_name]?PageNum=[nv.next;endpoint;magnet=a;mtype=m+m]">&gt;</a></td>

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

  </tr>

</table>


$TBS->MergeNavigationBar('nv','',$PageNum,$RecCnt,$PageSize) ;

$tpl->Render = TBS_OUTPUT ;

$TBS->Show() ;


Please help me out.  Thanks.
By: Skrol29
Date: 2006-07-08
Time: 23:19

Re: navigation and or pagination

Hi,

the MergeNavigationBar() method is no more supported in TBS 3.
You have to use the NavBar plug-in instead.

Your template can stay like it is.
But chnag your code like this:

include_once('tbs_plugin_navbar.php');
$tpl->PlugIn(TBS_NAVBAR,'nv','',$PageNum,$RecCnt,$PageSize) ;

$TBS->Show(TBS_OUTPUT) ;
By: Joe
Date: 2006-07-08
Time: 23:26

Re: navigation and or pagination

Now I get this error:

atal error: Call to a member function on a non-object in /home/sbgle/public_html/mrclean/forum/left.php on line 78

--- line 78 is this
$tpl->PlugIn(TBS_NAVBAR,'nv','',$PageNum,$RecCnt,$PageSize) ;
By: Skrol29
Date: 2006-07-08
Time: 23:45

Re: navigation and or pagination

What is you TBS version ?
By: Joe
Date: 2006-07-08
Time: 23:56

Re: navigation and or pagination

********************************************************
TinyButStrong - Template Engine for Pro and Beginners
------------------------
Version  : 3.1.1 for PHP >= 4.0.6
Date     : 2006-06-25
Web site : www.tinybutstrong.com
Author   : skrol29@freesurf.fr
********************************************************
By: Joe
Date: 2006-07-08
Time: 23:58

Re: navigation and or pagination

php code
<?

include_once('tbs_class.php') ;
//Connexion to the database

if (!isset($_SERVER)) $_SERVER=&$HTTP_SERVER_VARS ; //PHP<4.1.0

require($_SERVER['DOCUMENT_ROOT'].'/forum/cnx_mysql.php');

//$id = PageNum;

//Default value

if (!isset($_GET)) $_GET=&$HTTP_GET_VARS ;

if (isset($_GET['PageNum'])) {

  $PageNum = $_GET['PageNum'] ;

} else {

    $PageNum = 1 ;

}

//Default value

if (isset($_GET['RecCnt'])) {

  $RecCnt = intval($_GET['RecCnt']) ;

} else {

    $RecCnt = -1 ;

}

$PageSize = 1 ;

$TBS = new clsTinyButStrong ;

$TBS->LoadTemplate('left.html') ;

//Merge the block by page

$RecCnt = $TBS->MergeBlock('b1',$cnx_id,"SELECT * FROM threads ORDER BY id DESC",$PageSize,$PageNum,$RecCnt) ;

// Merge the Navigation Bar

include_once('tbs_plugin_navbar.php');
$tpl->PlugIn(TBS_NAVBAR,'nv','1',$PageNum,$RecCnt,$PageSize) ;

$TBS->Show(TBS_OUTPUT) ;


?>


html code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
    font-size: 9px;
    color: #CC0000;
}
-->
</style>
</head>

<body><table width=100% border=0>
<tr>
<td>
[b1;block=begin]
<a href="right.php?id=[b1.id]" target="mainFrame">[b1.subject]</a>&nbsp;&nbsp;<span class="style1">[b1.username] ([b1.date])</span><br />
[b1;block=end]</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_name]?PageNum=[nv.first;endpoint;magnet=a;mtype=m+m]">|&lt;</a></td>

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

    <td width="16"><a href="[var..script_name]?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_name]?PageNum=[nv.next;endpoint;magnet=a;mtype=m+m]">&gt;</a></td>

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

  </tr>

</table></div></td>
</tr>
</table>

</body>
</html>

By: Skrol29
Date: 2006-07-09
Time: 02:34

Re: navigation and or pagination

Replace $tpl by $TBS in your code.