Plugin

EE 1
EE 2
MD Detect Page Type

Developer

Ryan Masuga - Masuga Design

3rd Party (Free)

Creative Commons Attribution Share Alike Download v1.0.2

Compatibility

  • LG Addon Updater
  • Multi Site Manager
  • Stand Alone Entry Form

Requirements

  • jQuery for the Control Panel

Tags

Detect if you are on pagination page, category page, or yearly archive page.

You can use a single template to handle the “landing page” for an area as well as the single-entry version of the page with a couple {if segment_3 != ‘’} and {if segment_3 == ‘’} conditionals. But when you introduce pagination, everything gets messed up. The goal was to avoid having to make a separate template to handle the single entries when pagination is used on the the same template. The URLs should look like the following using the (very basic) code sample that follows.

www.site.com/group/template/ – The “landing” page, that may include paginated items
www.site.com/group/template/P## – A paginated page in this area
www.site.com/group/template/itemtitle/ – Using the same template for a single entry

Basic Example

{exp:md_detect_page_type url_segment="{segment_3}"}
Pagination Page: {if pagination_page}A Paginated Page{/if}
Category Page: {if category_page}This is a Category Page{/if}
Yearly Archive Page: {if yearly_archive_page}Yes!{/if} {/exp:md_detect_page_type}

Keep in mind that the Switchee plugin is also pretty useful for detecting page type, and may ultimately be more flexible.

Download MD Detect Page Type

EE Version Downloads Add-On Version Release Date
1.x Download 1.0.1 2008-09-28 12:00 AM
2.+ Download 1.0.2 2010-03-29 12:00 AM

MD Detect Page Type Links

This entry was last updated July 22, 2011, 4:12 am.

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!

There are no reviews for this add-on yet.

What are you waiting for? Rate it and review it!