Categories > TinyButStrong general >

Navigation Bar Problem

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: SarCaSM
Date: 2005-06-25
Time: 05:37

Navigation Bar Problem

ok, so the MergeBlock problem is fixed, but I'm having a problem with the navigation bar.  Its probably a problem with my code. 

Here is my PHP Code:
if (isset($story)) {
  $PageNum = $story;
} else {
  $PageNum = -1;
}

$RecCnt = -1 ;

$PageSize = 1;

$tbs->LoadTemplate('tpl/index.html');
$query = "SELECT stories.Content, images.Filename FROM stories, images WHERE images.ID = stories.Image ORDER BY Timestamp ASC";
$RecCnt = $tbs->MergeBlock('blk1',$cnx_id,$query,$PageSize,$PageNum,$RecCnt);
$tbs->MergeNavigationBar('nv','',$PageNum,$RecCnt,$PageSize);

Here is my HTML and TBS Stuff:
<div class="menu">
  <a class="menu" href="/">Current</a> | <a href="/?story=[nv.prev;endpoint;magnet=a;mtype=m+m]" class="menu">Previous</a>
  | <a href="/?story=[nv.next;endpoint;magnet=a;mtype=m+m]" class="menu">Next</a> | About
</div>

So when the user goes to the main page without defining $story, the last story is displayed.  With the code I show above, shouldn't the link for previous work and the link for next not be active?  Am I doing something wrong?
By: SarCaSM
Date: 2005-06-25
Time: 19:05

Re: Navigation Bar Problem

Well, I've sort of solved my problem.  before the mergenavigation i put the following:

if ($PageNum == -1)
  $PageNum = $RecCnt;

But shouldn't using -1 for $PageNum have yielded the same result pretty much?