By: Yves
Date: 2009-06-10
Time: 07:40
|
Navbar with tbsmysql please URGENT PLEASE
Hello
i m doing a test whith pluginNavBar and TBSmysql. I don't understand what happen.
This is my php code
<?php
require("../inc/connexion.php");
require("../inc/params.php");
include_once('../appli/class/tbs_class.php') ;
include_once('../appli/class/tbs_plugin_bypage.php'); // Plug-in By-Page
include_once('../appli/class/tbs_plugin_navbar.php'); // Plug-in Navigation Bar
//Connexion to the database
$PageSize = 20;
if (!isset($_SERVER)) $_SERVER=&$HTTP_SERVER_VARS ; //PHP<4.1.0
$con = mysql_connect(_HOST,_USER,_PASS);
mysql_select_db(_BASE_DE_DONNEES, $con);
//require($_SERVER['DOCUMENT_ROOT'].'/cnx_mysql.php');
//The file cnx_mysql.php contains the following lines :
// $cnx_id = mysql_connect('localhost','user','password') ;
// mysql_select_db('dbname',$cnx_id) ;
if (!isset($_GET)) $_GET=&$HTTP_GET_VARS ;
if (isset($_GET['PageNum'])) {
$PageNum = $_GET['PageNum'];
} else {
$PageNum = 1;
}
//echo '<br><br><br><br><br>';
//print_r($data);
// 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 {
//echo __LINE__;
$RecCnt = -1;
}
$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('../appli/templates/test.htm') ;
// Merge the block by page
$TBS->PlugIn(TBS_BYPAGE,$PageSize,$PageNum,$RecCnt); // Next block will be merged suing By-Page mode.
//$RecCnt = $TBS->MergeBlock('blk',$data);
// Merge the Navigation Bar
echo 'page size'.$PageSize;
$TBS->PlugIn(TBS_NAVBAR,'nv','',$PageNum,$RecCnt,$PageSize);
$TBS->MergeBlock('blk',$con,'SELECT dosact_id,dosact_ND, dosact_nom_client FROM dossiers_actifs') ;
mysql_close($con) ;
$TBS->Show()
|
end this is my template
<!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 MySQL Data Merge</p>
<table border="1" align="center" cellpadding="2" cellspacing="0">
<tr bgcolor="#CACACA">
<td width="50"><strong>Position</strong></td>
<td width="150"><strong>Id dossier</strong></td>
<td width="50"><strong>ND</strong></td>
<td width="100"><div align="center"><strong>Nom</strong></div></td>
</tr>
<tr bgcolor="#F0F0F0">
<td>[blk.#]</td>
<td>[blk.dosact_id;block=tr]</td>
<td><div align="right">[blk.dosact_ND]</div></td>
<td><div align="center">[blk.dosact_nom_client]</div></td>
</tr>
<tr bgcolor="#E6E6E6">
<td>[blk.#]</td>
<td>[blk.dosact_id;block=tr]</td>
<td><div align="right">[blk.dosact_ND]</div></td>
<td><div align="center">[blk.dosact_nom_client]</div></td>
</tr>
<tr bgcolor="#E6E6E6">
<td colspan="4" bgcolor="#FFCFB9">[blk;block=tr;nodata]There is no data. </td>
</tr>
</table>
<p align="center">There are [blk.#] displayed lines.</p>
<div align="center">
<p>Numbre total de dossiers: [var.RecCnt]</p>
<p>Affichage de <span class="text-section2">[var.PageSize].</span> dossiers par page<br>
<br>
</p>
</div>
<table border="1" align="center" cellpadding="2" cellspacing="0">
<tr align="center">
<td width="16"><a href="[var..script_name]?PageNum=[nv.first;endpoint;magnet=a;mtype=m+m]">|<</a></td>
<td width="16"><a href="[var..script_name]?PageNum=[nv.prev;endpoint;magnet=a;mtype=m+m]"><</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="#C4E1E1"><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]">></a></td>
<td width="16"><a href="[var..script_name]?PageNum=[nv.last;endpoint;magnet=a;mtype=m+m]">>|</a></td>
</tr>
</table>
<p align="center"> </p>
<p align="center"> </p>
</body>
</html>
|
When i run this i've all the lines of the table and a van bar who doesn't works of course
When i put off
<table border="1" align="center" cellpadding="2" cellspacing="0">
<tr align="center">
<td width="16"><a href="[var..script_name]?PageNum=[nv.first;endpoint;magnet=a;mtype=m+m]">|<</a></td>
<td width="16"><a href="[var..script_name]?PageNum=[nv.prev;endpoint;magnet=a;mtype=m+m]"><</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="#C4E1E1"><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]">></a></td>
<td width="16"><a href="[var..script_name]?PageNum=[nv.last;endpoint;magnet=a;mtype=m+m]">>|</a></td>
</tr>
</table>
|
of the template i've only the pagesize records, and no nav bar(Normal)
I don't understand
Please someone has an idea
THANKS
|
By: Skrol29
Date: 2009-06-10
Time: 09:40
|
Re: Navbar with tbsmysql please URGENT PLEASE
Hi Yves,
What do you mean by "a van bar who doesn't works of course" ?
You should move the "$TBS->PlugIn(TBS_BYPAGE,...)" to the line just before the MergeBlock().
This line is before the $TBS->PlugIn(TBS_NAVBAR,...) and is may interfere.
|
By: Yves
Date: 2009-06-10
Time: 14:55
|
Re: Navbar with tbsmysql please URGENT PLEASE
Thanks to you for this QUICK answer
It WORKS
I've just a little problem
I arrvie at the end of the table on page 4, i've the latstes records
But when i click on 4 on the navbar, the nav bar presents 5 and alwys the same latest record, when i click on 5 the navbar presents 6 etc..
Thanks
|