使用哈希和参数分页不起作用

I have page with a URL like this:

http://***.com/profile/username#profile_favs

With my pagination it looks like this:

http://***.com/profile/username?s=0&p=1#profile_favs

The last example doesn't work.

Basically my pagination-function looks like this:

function Pagination($pages, $start, $display, $link_url="", $anchor="") {

echo '<div id="pagination">';

    $current_page = ($start / $display) + 1;

    $paginator_num = 5;
    $pages_display = 10;

    if ($current_page > $pages - $paginator_num) {
        $paginator_num = $pages_display - ($pages - $current_page);
    } elseif ($current_page < $paginator_num + 1) {
        $paginator_num = $pages_display - $current_page;
    } else {
        $paginator_num = 5;
    }

    $min = max($current_page - $paginator_num, 1); 
    $max = min($current_page + $paginator_num, $pages); 

    for ($i = $min; $i <= $max; $i++) {
        if ($i != $current_page) {
            echo '<div class="pagination_link">';
                echo '<a href="/'.$link_url.'?s=' . (($display * ($i - 1))) . '&p=' . $pages . $anchor.'">' . $i . '</a>';
            echo '</div>';

        } else {
            echo '<div id="pagination_active" class="pagination_link">';
                echo $i . ' ';
            echo '</div>';
        }
    }       

    echo '</div>';
}

And this is the part that calculates the pages (this part gets included right before my pagination-function):

<?php
$display = $display_num;

if (isset($_GET['p']) && is_numeric ($_GET['p'])) {
    $pages = $_GET['p'];

} else {
    $total_results = $qr_num;

    if ($total_results > $display) {
        $pages = ceil ($total_results / $display);
    } else {
        $pages = 1;

    }
}

if (isset($_GET['s']) && is_numeric ($_GET['s'])) {

    $start = $_GET['s'];

} else {
    $start = 0;
}



?>

Now my question is: Is there any workaround possible to get that pagination working with a URL mentioned above:

http://***.com/profile/username?s=0&p=1#profile_favs

Actually I'd prefer a solution without GET-parameters. Any help, please?

  1. You could use an AJAX call with the XMPHttpRequest Object to fetch it without the get parameters.

  2. Another thing you could do (if you are using Apache) is to look at mod_rewrite for urls.

Hope that helps :)