josecebe / twbs-pagination

jQuery pagination plugin (bootstrap powered)
http://josecebe.github.io/twbs-pagination/
Other
1.1k stars 401 forks source link

How to use with laravel #118

Closed ofuochi closed 7 years ago

ofuochi commented 8 years ago

I always get this error from this line href:{{number}} when I try to use the href option Use of undefined constant number - assumed 'number' I have laravel 5.1 installed on my project, could this be the problem or is there something am doing wrong? How can I use the href option without getting this error?

eugenesimakin commented 8 years ago

Hi! Please, post your options here and if it possible some fiddle.

It may be integration issue or incorrect use of plugin options. If the last, see examples on gh-pages branch.

ofuochi commented 8 years ago

I was able to solve this issue by specifying hrefvariable:--number-- Laravel uses the double braces {{ }} to hold variable. There was a conflict between them. However, am faced with a new issue. The active pagination button does not change accordingly with the href. Its stays at 1. Here is my script

$('#pagination').twbsPagination({
    totalPages: 92,
    visiblePages: 10,
    href: '?page=--number--',
    hrefVariable:'--number--',
    initiateStartPageClick: false,
    onPageClick: function (event, page) {
    }
});

Here is my html <ul class="pagination" id="pagination"></ul>