Categories > TinyButStrong general >

[var.x] after [pro;block=tr;nodata]No products found

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Carl
Date: 2006-06-24
Time: 16:05

[var.x] after [pro;block=tr;nodata]No products found

This may seems really silly but for some reason if I place variables after a nodata event the variables throw an error, please help. my code below

<?php
###############################################################
# COPYRIGHT: DouBtles Web Design                              #
###############################################################
error_reporting(E_ALL ^ E_NOTICE); // Turn off notice reporting (its crap!)

include_once('tbs_class.php') ;

// Variables used
$url = "http://www.delphiblue.com";
$connect_id = mysql_connect("localhost", "store", "99500576") or die(mysql_error()); // Connect to MySQL
mysql_select_db("db_store",$connect_id) or die(mysql_error()); // Select database

if (isset($_GET['catid'])){$catid = $_GET['catid'];}
if (isset($_GET['page'])){$page = $_GET['page'];}else{$page = 1;}
$catid = "1";
$perpage = 10;
$to = $page * $perpage;
$from = $to - $perpage + 1;
$npage = $page + 1;
if ($to > $found) {$to = $found; $npage = $npage - 1;}
if ($page > 1){$ppage = $page - 1;}else{$ppage = 1;}
if ($found == 0){$from = 0;}

// Main MySQL queries
$products = mysql_query ("SELECT * FROM tbl_product WHERE cat_id = '$catid'");
$pfound = mysql_num_rows($products);

// Get all categories at level 0 (main categories)
$categories = mysql_query ("SELECT * FROM tbl_category WHERE cat_level=0");
$subcat = mysql_query ("SELECT * FROM tbl_category WHERE cat_parent='catid'");
mysql_close($connect_id);

$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('./templates/browse.htm');
$TBS->MergeBlock('cat',$categories);
$TBS->MergeBlock('pro',$products);
$TBS->Show();

?>

HTML:

<details>
                      <tr>
                        <td width="120" height="120" rowspan="4" align="center" valign="middle"><a href="[var.url]/product.php?id=[pro.pd_id]"><img src="images/products/[pro.pd_image]" width="80" height="80" border="0"></a></td>
                        <td width="360" height="22" class="header">[pro.pd_name;block=details]</td>
                      </tr>
                      <tr>
                        <td height="20"><img src="images/spacer.gif" width="1" height="1"></td>
                      </tr>
                      <tr>
                        <td height="64" valign="top"><span class="shortdesc"><font face="Arial, Helvetica, sans-serif">[pro.pd_description]</font></span>...<a href="[var.url]/product.php?id=[pro.pd_id]" class="morelink">more</a></td>
                      </tr>
                     
                      <tr>
                        <td height="15" align="right" class="price"><div align="right">&pound;[pro.pd_price]</div></td>
                      </tr>
                      <tr>
                        <td height="24" colspan="2" align="center"><img src="images/dotted.gif" width="175" height="3"><img src="images/dotted.gif" width="175" height="3"></td>
                        </tr>
                        </details>
                        <tr>
                          <td height="24" colspan="2" align="center">[pro;block=tr;nodata]<span class="header">No products found</span></td>
                        </tr>
                        <tr>
                          <td height="24" colspan="2" align="center"><span class="Footer">showing products </span><span class="header">[var.from]</span><span class="Footer"> to </span><span class="header">[var.to]</span><span class="Footer"> of </span><span class="header">[var.found]</span> </td>
                        </tr>

for some reason var.to , var.from throw and error??
By: Carl
Date: 2006-06-24
Time: 16:21

Re: [var.x] after [pro;block=tr;nodata]No products found

never mind solved it.  turned out the variables were not being set at all so was as if they didn't exist...