Page 1 of 1

pagination header for dynamic website

Posted: Wed Sep 02, 2015 4:20 am
by mkmagloire
Greetings,

I'm really new in programming stuffs, you help is more than welcome.
I have a concern and I'm still not able to sort it out until now.
I'd like to create seo pagination for website's results page, and have it into the html header.
The problem is, I'm not really able to do it as the previous developer choose to use javascript: void(0) instead. I'd like to change it.
Here is the current code:

Code: Select all

$total_page = ceil($total/$perpage);
    $startpoint = ($page * $perpage) - $perpage;
    $lim = 5;
    $link = 'javascript:void(0);';
    $pdata = '<div class="pg2_pagnation" style="float:right">'.pagination_front($page,$total_page,$link,$lim).'</div>';
The output of the page is:

123 Next or Previous 12345 Next. (While having the cursor on the pagination, the shows javascript:void(0))
However, I'm facing some issues with my javascript, so, would prefer to avoid that and to have a proper link on the pagination.
I'd like to better have some thing like: http:www.example/cars/page1, http:www.example/cars/page2, http:www.example/cars/page3, ... http:www.example/cars/page10 (last page) instead.

Also, regarding the header, I'd like to use the pagination for some seo purposes and have:

Code: Select all

<link rel="canonical" href="https://www.example.com/page1">
    <link rel="prev" href="https://www.example.com/page2">
    <link rel="next" href="https://www.example.com/page4">


Thanks in advance for your time and your contribution.

Re: pagination header for dynamic website

Posted: Wed Sep 02, 2015 7:23 am
by social_experiment
I'll explain assuming that you are retrieving records from a database and want to paginate those; you have to page along the amount of elements per page and the starting point for the next set of records. The url might look like this: www.example.com?s=5&ipp=5 (s is the starting point from where you select and ipp is the amount of items per page.

Below is a link that you can have a look at, (if you haven't already googled)
http://www.tutorialspoint.com/php/mysql_paging_php.htm

hth