Categories > TinyButStrong general >

Navigation bar AND onformat

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: It is just me
Date: 2004-03-06
Time: 23:21

Navigation bar AND onformat

Hi all,

First of all, Thanks for TinyButStrong. I love it.

I taked the 2 files from the downloaded package:
  tbs_us_examples_page.php
  tbs_us_examples_page.htm

in the file tbs_us_examples_page.php I just add a function called formatLink like this:

function formatLink($b, &$v)
{
  $v = "tbs_us_examples_page.php?a=10&b=20&c=baba&NumPage=$v";
}

in the file tbs_us_examples_page.htm I just changed these lines:

  <tr align="center">

    <td width="16"><a href="[sys.script_name]?PageNum=[nv.first;endpoint;friend2=a]">|&lt;</a></td>

    <td width="16"><a href="[sys.script_name]?PageNum=[nv.prev;endpoint;friend2=a]">&lt;</a></td>

    <td width="16"><a href="[sys.script_name]?PageNum=[nv.page;block=td]">[nv.page]</a></td>

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

    <td width="16"><a href="[sys.script_name]?PageNum=[nv.next;endpoint;friend2=a]">&gt;</a></td>

    <td width="16"><a href="[sys.script_name]?PageNum=[nv.last;endpoint;friend2=a]">&gt;|</a></td>

  </tr>


with these lines:

  <tr align="center">

    <td width="16"><a href="[nv.first;endpoint;friend=a;onformat=formatLink]">|&lt;</a></td>

    <td width="16"><a href="[nv.prev;endpoint;friend=a;onformat=formatLink]">&lt;</a></td>

    <td width="16"><a href="[nv.page;block=td;onformat=formatLink]">[nv.page]</a></td>

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

    <td width="16"><a href="[nv.next;endpoint;friend=a;onformat=formatLink]">&gt;</a></td>

    <td width="16"><a href="[nv.last;endpoint;friend=a;onformat=formatLink]">&gt;|</a></td>

  </tr>


Did I something wrong ? If yes, WHAT ?
Because the result is a stronge:
1- The 'first' and 'prev' links are always there when the PageNum=1
2- The same with the 'next' and 'last'  links when the PageNum=4
3- When the PageNum=4 and I click 'next'  or last, I get a page containing only the first record
By: It is just me
Date: 2004-03-06
Time: 23:29

Re: Navigation bar AND onformat

Sorry,

In the function formatLink , change 'NumPage' with 'PageNum'

Thanks.
By: Skrol29
Date: 2004-03-09
Time: 10:22

Re: Navigation bar AND onformat

Hi,

You have this behviour because parameter 'friend' is evaluated after parameter 'onformat'. The value is no longer an empty value after passed to your formatLink() function.

An issue could be to make a test in the formatLink() function to make it not changing $v if it's an empty string.
By: It is just me
Date: 2004-03-09
Time: 11:23

Re: Navigation bar AND onformat

Hi Skrol29,

Thanks for your reply.
Your suggestion do resolve the problem :-)