Page 1 of 1

Message turn to next page

Posted: Mon Apr 14, 2008 3:46 am
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

Posted: Mon Apr 14, 2008 3:11 pm
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.

Posted: Mon Apr 14, 2008 3:32 pm
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: