BMS URL Change
Developer
3rd Party (Free)

EE Version Support
- ExpressionEngine 2
Compatibility
If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.
- Updater
- Multi Site Manager
- Stand Alone Entry Form
- Low Variables
- Content Elements
- Better Workflow
- Matrix
- Grid
- Webservice
- Publisher
Requirements
- jQuery for the Control Panel
Add-On Type(s)
Plugin
Tags
- paginate, pagination, links, pagination links, segment, url, p#, page, number
Ever wanted to change the pagination segment in your URLs from P# to a page number? This plugin makes it a breeze.
Ever wanted to change the pagination segment in your URLs from P# to a page number? This plugin makes it a breeze.
By default, when ExpressionEngine paginates a list of entries, it appends P# to the URL, where # is the number by which the entries to be shown are offset. Now, you can have a page number appended to the URL instead. So with 20 entries per page, the following URLs would change from:
/blog/P20
/blog/P40
/blog/P60
etc.
to:
/blog/2
/blog/3
/blog/4
etc.
This plugin makes it really easy to achieve this. All that you need to do is insert the tag into your template in two locations:
- Insert the {exp:bms_url_change pp=”“} tag (no closing tag) right before your {exp:channel:entries} tag. The pp= parameter reflects the number of entries per page; this must match the limit= parameter on the {exp:channel:entries} tag pair.
- Wrap the {exp:bms_url_change:link pp=”“}...{exp:bms_url_change:link} tag pair around the {paginate} tag pair. As above, the pp= parameter reflects the number of entries per page; this must match the limit= parameter on the {exp:channel:entries} tag pair.
This plugin will also add a trailing slash to all links, so if you want to prevent that, set the slash parameter, like so: {exp:bms_url_change:link pp=“20” slash=“no”}
But what if you wanted the pagination url to be /page-2 rather than just /2? All you need to do is include the pbase= parameter in every instance of the {exp:bms_url_change} tag and the {exp:bms_url_change:link}...{/exp:bms_url_change:link} tag pair. To set the pagination base to page-, simply set pbase=“page-”.
For example, with 20 blog entries showing per page, this is how you would change the pagination links from /P20, /P40, etc. to /2, /3, etc. The code used inside the {paginate} tag pair is taken straight from the EE docs on pagination.
{exp:bms_url_change pp="20"}
{exp:channel:entries channel="blog" limit="20" paginate="both"}
{!-- insert the paginate tag pair --}
{paginate}
{if total_pages > 1}
{exp:bms_url_change:link pp="{lv_se_perpage}"}
{pagination_links}
<div class="pagination">
<ul>
{first_page}
<li><a href="{pagination_url}" class="page-first">First</a></li>
{/first_page}
{previous_page}
<li><a href="{pagination_url}" class="page-previous">Previous</a></li>
{/previous_page}
{page}
<li><a href="{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
{/page}
{next_page}
<li><a href="{pagination_url}" class="page-next">Next</a></li>
{/next_page}
{last_page}
<li><a href="{pagination_url}" class="page-last">Last</a></li>
{/last_page}
</ul>
</div>
{/pagination_links}
{/exp:bms_url_change:link}
{/if}
{/paginate}
{!-- display the entry --}
<div class="entry">
<h3>{title}</h3>
...
</div>
{/exp:channel:entries}
I am working on an extension to make Step #2 (wrapping the tag pair around all links in the paginate tag pair) redundant, but for now it will have to do.
Changelog
Version 0.2; 10/01/2012
- Made exp:bms_url_change:link tag easier to use.
- Trailing slash added to links; can be disabled.
- Fixed bug with odd number of entries per page
Download BMS URL Change
EE Support | Downloads | Add-On Version | Release Date |
---|---|---|---|
Not Specified | Download | 0.2 |
BMS URL Change Links
This entry was created January 6, 2012, 9:41 am.
This entry was last updated January 9, 2012, 8:08 pm.
Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!
Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.
1 Review:
SaraT 01.08.12
Love the idea! However, it needs some work. As of v0.1, it will only paginate correctly if you use it with limit=“any even number”. With odd numbers it links to fractions of a pagination page like site.com/blog/1.5. If that’s fixed and the tags were more simple to use, it’d be 5/5.