Message turn to next page

Is message board greying out your hair (at least what's left of it)? Let us help you here
Locked
ngosac
Posts: 15
Joined: Sun Mar 23, 2008 3:30 am

Message turn to next page

Post by ngosac »

Script URL:http://www.ngogiatrang.com/xnxphptestboard/mboard.php
Version of script: mBoard 1.3


Hi Klemen and Henrie,

I have tried to make mBoard turns to next page when it reach to a preset count msg. I used some code from gBook 1.6 and added them to mBoard . The result is good as I wanted. The ONLY problem is when I click the page, next page (and any link page) it doesn't go to that link page. I understand the difference is gBook uses text database and mBoard saves msg in html files. I have searched PHP site and hope to learn some knowledge to fix that issue but no luck at all. Below is the code where I put them in mBoard . Please help me to correct the problem if it not take too much of your time:


<div align="center"><center>
<table border="0" width="95%"><tr>
<td>

<p><a href="#new"><b>New topic</b></a></p>
<hr>
<p align="center"><b>Recent topics</b></p>
<ul>
<?php
include_once 'threads.txt';

// adding page turn

$page=pj_isNumber($_REQUEST['page']);
if ($page>0) {
$start=($page*10)-9;$end=$start+9;
} else {
$page=1;$start=1;$end=10;
}

$lines= file("threads.txt");
$total = count($lines);

if ($total > 0) {
if ($end > $total) {$end=$total;}
$pages = ceil($total/10);

echo '<p>'.sprintf($lang['t01'],$total,$pages).'<br />';

$gbook_nav = '';

if ($pages > 1)
{
$prev_page = ($page-1 <= 0) ? 0 : $page-1;
$next_page = ($page+1 > $pages) ? 0 : $page+1;

if ($prev_page)
{
$gbook_nav .= '
<a href="mboard.php?page=1"><< '.$lang['t02'].'</a>
&nbsp;|&nbsp;
<a href="mboard.php?page='.$prev_page.'">< '.$lang['t03'].'</a>
&nbsp;|&nbsp;
';
}

for ($i=1; $i<=$pages; $i++)
{
if ($i <= ($page+5) && $i >= ($page-5))
{
if($i == $page) {$gbook_nav .= ' <b>'.$i.'</b> ';}
else {$gbook_nav .= ' <a href="mboard.php?page='.$i.'">'.$i.'</a> ';}
}
}

if ($next_page)
{
$gbook_nav .= '
&nbsp;|&nbsp;
<a href="mboard.php?page='.$next_page.'">'.$lang['t04'].' ></a>
&nbsp;|&nbsp;
<a href="mboard.php?page='.$pages.'">'.$lang['t05'].' >></a>
';
}
}

echo $gbook_nav;

echo '</p>';
}

if ($total == 0) {
echo '
<table border="0" cellspacing="0" cellpadding="2" width="95%" class="entries">
<tr>
<td style="text-align:center"><br />'.$lang['t06'].'<br />&nbsp;</td>
</tr>
</table>
';
}

else {printAddNewTopic;}

// end adding page turn



Million thanks in advance
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

I'm afraid it isn't that simple, you would need a system to either break threads.txt in several files (one for each page) or include just a part of threads.txt for each page (not the entire one). Unfortunately that would take quite some editing and is out of the scope of my support.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ngosac
Posts: 15
Joined: Sun Mar 23, 2008 3:30 am

Post by ngosac »

Hi Klemen,

Thank you for your time to answer the question . That make me understand the process of that issue :D

I hope that would be included in the next version. :idea:
Locked