Older Newer
Thu, 02 Apr 2009 23:56:02 . . . . pa236.lubiewo.sdi.tpnet.pl


Changes by last author:

Added:
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 smarty.net 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:

<code>

{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"}

</code>

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:

<code>

index.php

SmartyPaginate::setUrlVar("page");

.htaccess

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

</code>

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:

<code>

http://www.example.com/mylist-1.html

</code>

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.

=== Download ===

Download: http://www.speedyshare.com/407253563.html

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