SmartyPaginateRewrite is a modified part of the SmartyPaginate package. There were many complains and questions about integration mod_rewrite with the pagination. This package contains modified paginate functions which allows you to use rewrite engine easily. I didn't notice any bugs or errors so if there are any - let us know on the forum.

How to use it in my template:

Same way as originally SmartyPaginate tags. All you have to do is just to add new param to existing tag. Example:

   {paginate_first text="Fist page" rewrite="mylist-@@@.html"}
   {paginate_prev text="Previous page" rewrite="mylist-@@@.html"}
   {paginate_middle page_limit="5" rewrite="mylist-@@@.html"}
   {paginate_next text="Next page" rewrite="mylist-@@@.html"}
   {paginate_last text="Last page" rewrite="mylist-@@@.html"}

Of course @@@ will be changed to number of page automatically. You can't change replacable string, it's just @@@ and cannot be modified ;).

How to use it in my php files

If you set your urlVar by SmartyPaginate::setUrlVar function, urlVar will be not ignored when you use rewrite parameter. It doesn't appear in returned string, but this is very still important variable and you have to remember about it when you write your new rewrite rules. Let's see:

       RewriteRule ^mylist-(.*).html$ index.php?section=mylist&page=$1 [L,NC]

In the following example we have set urlVar to "page" (default is "next") and added page parameter to rewrite rule. It's very important to let parser know what to do with variable. That's why we had to not forget about this var.

What is it for

Remember that setting rewrite param in template lets you decide how your link should look. In following example, you'll get:

If you won't add rewrite param to template, SmartyPaginate will behave just like it used to before files modification. There are no more changes in the source code.



Sorry for free hosting ;-). Couldn't find anything better at this moment :P.