anyone know this? PAGANATION based on characters of a variable..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    anyone know this? PAGANATION based on characters of a variable..

    i know the concept of paganation and im already working for this..

    but i know is based on the ROW in the DATABASE..

    I want PAGANATION that based on a no. of character of a variable or a ONE data from the database.

    Lets say that if a character/variable is more than 100 chars. then it paginate. :D

    ....

    `Coding-Talk`
    a place where noobs become professionals

    Added after 3 minutes:

    who can give me a example of an explanation is a coding-talk professional :D
    Last edited by leadiztah; 07.07.11, 00:07.

    #2
    Same all.
    GET page,
    read var lenght,
    condition if counted var > 100
    split it.
    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

    Comment


      #3
      If you want to cut a paragraph with 450 characters
      and give you 5 pages.

      Then refer to the lavalair blog coding.
      Did I help you?
      You can help me too
      Your donations will help me finance my studies.

      Comment


        #4
        i think this should work, havent tested it.

        PHP Code:
        <?
        $page = $_REQUEST['page'];


        $text = 'some looooooooooooong text';

        $text_length = strlen($text);
        $number_of_symbols_per_page = 100;

        if($page>0)
        {
            $start = $number_of_symbols_per_page*($page-1);
        }
        else
        {
            $page = 1;
            $start = 0;
        }


        echo substr($text, $start, $number_of_symbols_per_page);

        if($text_length>0)
        {
            $number_of_pages = ceil($text_length/$number_of_symbols_per_page);
        }
        if($number_of_pages>0)
        {
            echo 'Pages: ';
            for($i=1;$i<=$number_of_pages;$i++)
            {
                if($page==$i)echo '['.$i.']'; else echo '<a href="'.$_SERVER["PHP_SELF"].'?page='.$i.'">'.$i.'</a> ';
            }
        }

        ?>
        Added after 5 minutes:

        Originally posted by leadiztah View Post
        ....

        `Coding-Talk`
        a place where noobs become professionals

        Added after 3 minutes:

        who can give me a example of an explanation is a coding-talk professional :D
        if you continue posting texts like this nobody will help you.
        Last edited by GumSlone; 07.07.11, 21:55.
        Advertise your mobile site for FREE with AdTwirl

        Comment

        Working...
        X