How can I append:
#products
To the end of the pagination URL used by Laravels pagination links method so I could get the following in the address bar?:
products?page=3#products
This is so that my mobile users and people with low resolution desktops don't have to scroll down the page every time they navigate using the pagination links.
This is what I have in my config/view:
/*
|--------------------------------------------------------------------------
| Pagination View
|--------------------------------------------------------------------------
|
| This view will be used to render the pagination link output, and can
| be easily customized here to show any view you like. A clean view
| compatible with Twitter's Bootstrap is given to you by default.
|
*/
'pagination' => 'products.ProductPresenter',
And I'm getting:
Method Illuminate\View\View::__toString() must not throw an exception
My presenter as per Laravel documentation:
class ProductPresenter extends Illuminate\Pagination\Presenter {
public function getActivePageWrapper($text)
{
return '<li class="current"><a href="">'.$text.'</a></li>';
}
public function getDisabledTextWrapper($text)
{
return '<li class="unavailable"><a href="">'.$text.'</a></li>';
}
public function getPageLinkWrapper($url, $page, $rel = null)
{
return '<li><a href="'.$url.'">'.$page.'</a></li>';
}
}