Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Pagination
jailbox
post Nov 12 2004, 06:27 PM
Post #1


Newbie [Level 2]
**

Group: Members
Posts: 36
Joined: 22-July 04
Member No.: 165



Can anyone help me with pagination of a txt file which looks something like this:

some message <br/>
some message <br/>
some message <br/>
some message <br/>
some message <br/>
some message <br/>
some message <br/>



The <br/> tag is the end of the message. Anyone?
Go to the top of the page
 
+Quote Post
Roly
post Nov 13 2004, 03:24 AM
Post #2


Advanced Member
*******

Group: Members
Posts: 144
Joined: 24-July 04
From: Arizona
Member No.: 189



pagination? what?
Go to the top of the page
 
+Quote Post
DMA
post Nov 13 2004, 04:42 AM
Post #3


Member [Level 1]
****

Group: Members
Posts: 66
Joined: 21-October 04
Member No.: 1,872



no idea
Go to the top of the page
 
+Quote Post
jailbox
post Nov 13 2004, 09:57 AM
Post #4


Newbie [Level 2]
**

Group: Members
Posts: 36
Joined: 22-July 04
Member No.: 165



Atleast the guys at devshed know what it is.
You know, in google, it divides the search results in multiple pages. I want it to do it with a txt file
Go to the top of the page
 
+Quote Post
X3r0X
post Nov 13 2004, 10:06 AM
Post #5


^^ Thats me ^^
*********

Group: Members
Posts: 528
Joined: 14-July 04
Member No.: 90



Thats incorrect. It should be <BR> instead of </BR>. It seems like the person was trying to use another forum of HTML and trying to close the brackets tongue.gif
Go to the top of the page
 
+Quote Post
jailbox
post Nov 13 2004, 10:25 AM
Post #6


Newbie [Level 2]
**

Group: Members
Posts: 36
Joined: 22-July 04
Member No.: 165



QUOTE(Rival @ Nov 13 2004, 10:06 AM)
Thats incorrect. It should be <BR> instead of </BR>. It seems like the person was trying to use another forum of HTML and trying to close the brackets tongue.gif
*



I forgot to mention that its not html. Its wml. For wap. So <br/> is 100% correct
Go to the top of the page
 
+Quote Post
krap
post Nov 18 2004, 04:19 PM
Post #7


Super Member
*********

Group: Members
Posts: 204
Joined: 6-October 04
From: London, uk
Member No.: 1,444



He said <br/> not </br> anyway tongue.gif
Go to the top of the page
 
+Quote Post
Hamtaro
post Nov 19 2004, 02:37 AM
Post #8


Super Member
*********

Group: Members
Posts: 372
Joined: 14-October 04
Member No.: 1,736



Even in regular HTML, <br/> is also correct. Many HTML tags that don't have a closing tag (like <img>) can also be used that way. Anyway, back on topic:
I'm sorry, but I have no idea how I could help you...sorry!
Go to the top of the page
 
+Quote Post
mizako
post Nov 21 2004, 10:06 AM
Post #9


Super Member
*********

Group: Members
Posts: 372
Joined: 16-August 04
From: Spain
Member No.: 824



I suppose you want to provide pagination using PHP. I created a guestbook with pagination for one of my pages. Basically i have all my entries in a MySQL database and using php code i achieve pagination. Maybe if you do not want to use a database, you can modify the algorithmus a little bit to work with text files.
Here is my code:

CODE

<?php
   $sql_db     = "Db_Name";
   $sql_user   = "Db_User";
   $sql_pass   = "Db_Passwd";
   $sql_table  = "Db_Table";
   
   if(isset($pos)==0)
       $pos=0; // start position for the page indexer
   $count=3; // number of displayed items per page
   
   mysql_connect("localhost", $sql_user, $sql_pass);
   mysql_select_db($sql_db);
   $result = mysql_query("select MAX(id) from ".$sql_table.";");
   $data = mysql_fetch_assoc($result);
   $size = $data['MAX(id)'];
   $result = mysql_query("SELECT * FROM ".$sql_table." where id>".$pos.";");
   if($result)
   {
       $i=0;
       while(($data = mysql_fetch_assoc($result)) && ($i < $count))
       {
           // Here you should add text
           $i++;
       }
   }
   mysql_close();
   print "<div>Pages:";
   for($j=0; $j<$size; $j++)
       if(!($j % $count))
           print "<a href=\"book.php?pos=".$j."\">".(($j/$count)+1)."</a>\n";
   print "Total number of entries: ".$size."\n";
   if ($pos > 0)
       print "<a href=\"book.php?pos=".($pos-$count)."\">Back</a>\n";
   if($size > $pos+$count)
       print "<a href=\"book.php?pos=".($pos+$count)."\">Next</a>\n";
?>


Let me know if i can help you in oder way.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic