Hey everyone,
I am stressing out here trying to fix the pagination. Firstly, I just learn some basics of PHP recently so please go easy on me. So here is my problem,
I am currently using CuteNews 1.5.3, and everything works okay so far except for the pagination where it is giving weird errors. I e-mailed the CuteNews team but they haven’t got back to me for a long time so I decided to come here and post for help.
Take a look at this example that outline the problem,
[Prev] [1] [2] [3] [4] [Next]
At page 2 of the news, the URL for page 2 is site.com/news.php?start_from=5. If I click on the [PREV] or [1], the URL will remain as site.com/news.php?start_from=5. However [3], [4] and [Next] work perfectly fine.
If I go to page 3 of the news, the URL for page 3 is site.com/news.php?start_from=10. The [PREV] on this page works fine (it allows me to return to page 2) but the [1] URL will remain as site.com/news.php?start_from=10.
This situation goes on for the rest of the page. To sum it up, basically the [1] URL will always be the same as the URL you are currently at. And the [PREV] URL will be the same as the URL you are currently at only if you are at page 2.
This is the PHP code that affects the pagination,
[php]    // Triggerred by $config_disable_pagination = TRUE
if ($config_disable_pagination == 0)
{
// << Previous & Next >>
$prev_next_msg = $template_prev_next;
    //----------------------------------
    // Previous link
    //----------------------------------
    if ($start_from)
    {
        $prev = $start_from - $number;
        $URL = $PHP_SELF . build_uri('start_from,ucat,archive,subaction,id:comm_start_from', array($prev, $ucat, $url_archive, $subaction, $id));
        $URL = hook('rewrite_active_news_plink', $URL);
        $prev_next_msg = preg_replace("'\[prev-link\](.*?)\[/prev-link\]'si", '<a href="'.$URL.'">\\1</a> ', $prev_next_msg);
    }
    else
    {
        $prev_next_msg = preg_replace("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1", $prev_next_msg);
        $no_prev = true;
    }
    //----------------------------------
    // Pages
    //----------------------------------
    $pages = '';
    if ($number)
    {
        $pages_count        = ceil($count_all / $number);
        $pages_start_from   = 0;
        for($j=1; $j<= $pages_count; $j++)
        {
            if ( $pages_start_from != $start_from)
            {
                $URL = $PHP_SELF . build_uri('start_from,ucat,archive,subaction,id:comm_start_from', array($pages_start_from, $ucat, $url_archive, $subaction, $id));
                $URL = hook('rewrite_active_news_link', $URL);
                $pages .= '<a href="'.$URL.'">'.$j.'</a> ';
            }
            else $pages .= '<strong>'.$j.'</strong> ';
            $pages_start_from += $number;
        }
    }
    else
    {
        $no_next = true;
        $no_prev = true;
    }
    $prev_next_msg = str_replace("{pages}", $pages, $prev_next_msg);
    //----------------------------------
    // Next link  (typo here ... typo there... typos everywhere !)
    //----------------------------------
    if ($number < $count_all and $i < $count_all)
    {
        $URL = $PHP_SELF . build_uri('start_from,ucat,archive,subaction,id:comm_start_from', array($i, $ucat, $url_archive, $subaction, $id));
        $URL = hook('rewrite_active_news_nlink', $URL);
        $prev_next_msg = preg_replace("'\[next-link\](.*?)\[/next-link\]'si", '<a href="'.$URL.'">\\1</a>', $prev_next_msg);
    }
    else
    {
        $prev_next_msg = preg_replace("'\[next-link\](.*?)\[/next-link\]'si", "\\1", $prev_next_msg);
        $no_next = TRUE;
    }
    if (!$no_prev or !$no_next) echo $prev_next_msg;
}[/php]
This is the PHP code that outputs the pagination to my HTML page,
[php]<?php
$number=“5”;
include("/site/show_news.php");
?>[/php]
Does anyone know how to solve it? Thanks!
