Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
splitting list in pages
Old 07-23-2006, 05:16 AM splitting list in pages
Mad182's Avatar
Skilled Talker

Posts: 54
Name: Madars
Location: Latvia
Trades: 0
I'm writting little forum script, and I need help a bit. I want, that in one page would show like 10 or 20 threads and on bottom links to other pages, but I can't figure out how to do that. There is part of code (I know, it's crappy):

PHP Code:
<table width="596" cellspacing="1" cellpadding="7">
<?php
$handle 
opendir("./dati/forums/t"); 
    while ((
$file readdir($handle))!==false) { 
        if (
$file != "." && $file != "..") { 
        
$failsfopen("./dati/forums/t/$file""r");
        
$dati fread($failsfilesize("dati/forums/t/$file"));
        list(
$niks$nosaukums$teksts$datums$ip) = explode("|"$dati);
        
$links str_replace(".txt"""$file);
?>
    <tr>
        <td>
        <b><a href="?id=<?php echo "$links"?>"><?php echo "$nosaukums"?></a></b> autors: <a href="?id=profils&amp;lietotajs=<?php echo "$niks"?>"><?php echo"$niks"?></a> @ <?php echo "$datums"?><br />
        </td>
    </tr>
<?php
        fclose
($fails); 
     }     

closedir($handle);
?>
</table>
Sorry, it's in latvian, but I hope you will understand everything
__________________
There's no place like 127.0.0.1

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Mad182 is offline
Reply With Quote
View Public Profile Visit Mad182's homepage!
 
 
Register now for full access!
Old 07-23-2006, 12:45 PM Re: splitting list in pages
metho's Avatar
Ultra Talker

Posts: 481
Location: Gold Coast - Brisbane QLD, Australia
Trades: 0
You need to do a google search for 'php' 'mysql' 'pagination'. Pagination is the term used to describe the functionality that you're describing.

One of the more useful tutes for pagination is here:

http://www.phpfreaks.com/tutorials/73/0.php
__________________
I do
Please login or register to view this content. Registration is FREE
based.
Spend a lot of time in
Please login or register to view this content. Registration is FREE
.
And
Please login or register to view this content. Registration is FREE
chews up the rest.
metho is offline
Reply With Quote
View Public Profile Visit metho's homepage!
 
Old 07-23-2006, 02:27 PM Re: splitting list in pages
Mad182's Avatar
Skilled Talker

Posts: 54
Name: Madars
Location: Latvia
Trades: 0
Thanks, but is there a way how to do it with flat files?
__________________
There's no place like 127.0.0.1

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Mad182 is offline
Reply With Quote
View Public Profile Visit Mad182's homepage!
 
Reply     « Reply to splitting list in pages
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13229 seconds with 12 queries