This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Atok
Atok

What is the markup to render "next" or "prev" link instead of "1 2 3 4 ... next" pagination? Or, just how to fully customize it?

Atok
Atok

I almost forget to mention; the components I meant is Rainlab Blog.

Crazymodder
Crazymodder

simply make somethink like this:

{% if posts.currentPage > 1 %}
        <li><a href="{{ this.page.baseFileName|page({ (pageParam): (posts.currentPage-1) }) }}">&larr;     Prev</a></li>
    {% endif %}
{% if posts.lastPage > posts.currentPage %}
        <li><a href="{{ this.page.baseFileName|page({ (pageParam): (posts.currentPage+1) }) }}">Next &rarr;</a></li>
    {% endif %}
Atok
Atok

I'll try this!

kevin.vermeulen
kevin.vermeulen

Is this also possible for a Blog post?

ndugu
ndugu

@Crazymodder

I tried your code, but it doesn't do anything. I don't even get an error. So, where do I put the code? In which file? Is there something else I have to do?

kubis
kubis

I don't know if you are using this for plugin or not, but for me worked the solution from documentation about pagination, where you use

$users = Db::table('users')->simplePaginate(15);

for pagination next/prev of 15 users.

in default.htm you have to put something like

<div class="container"> {% for user in users %} {{ user.name }} {% endfor %} </div>

{{ users.render|raw }}

last row do the trick.

hope it helps.

Last updated

petermezes
petermezes

Hi Atok.

I was dealing with this short while ago. Im using rainlab.blog as well. You have to create duplicate partial of the original pagination to override it. To do so, go to your theme folder, partials and create folder with exactly same name/alias (in my case was blogPosts) as is your compoment.

Then go to plugins > rainlab > blog > components > posts a copy this default.htm file to your newly created folder. So you will have theme > yourtheme > partials > blogPosts(or your name) > default.htm there.

Now you can adjust the pagination + post list as you want. Your own classes, styles, whatever you need. And these changes wont be overwritten on your plugin update.

Last updated

1-8 of 8

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.