Advanced Prev Next Entry (APNE)

2.0.0
Can Oğuz
19.03.2012

Dieses Plugin bringt einige erweiterte Funktionen und etwas mehr Freiheit, um "vorherige - naechste" Links aufzubauen.

  • Return Matrix fields.
  • Search Playa fields.
  • Filter entries by a variety of search criteria.
  • Filter entries by category or category group.
  • Filter entries by channel id or channel name.
  • Filter expired entries.
  • Filter future entries.
  • Filter entries by site id for MSM installed environments.
  • Reverse prev and next links.
  • Return only requested fields.
  • Sort entries by both standard and custom fields.
  • Cycle through entries when the end of list is reached.
  • Search tag supports Playa Field Type (only channel entry id and url title).

Installation

  1. Download the plugin.
    You can buy and download the plugin from above link or from Devot:ee.
  2. Unzip the file.
  3. Upload the folder to your server.
    You will see a folder named bbr_prevnext_entry.
  4. Upload this folder to your EE installation's system/expressionengine/third_party folder.

Parameters

Required Parameters:

  • current_url_title
    This is the url title of the current entry. Next and previous entries are returned based on this entry.
    current_url_title="an_entry"
  • current_entry_id
    This is the entry id of the current entry. Next and previous entries are returned based on this entry.
    current_entry_id="232"

WARNING

Do NOT enter both of these parameters. Use ONLY one.

Optional Parameters:

  • category
    Filter entries by category.
    category="1&&2"
    category="1|3|5"
    category="not 1"
  • category_group
    Filter entries by category group
    category_group="1&&2"
    category_group="1|3|5"
    category_group="not 1"
  • channel_id
    Filter entries by channel id.
    channel_id="1"
  • channel_name
    Filter entries by channel name.
    channel_name="blog_entries"
  • cycle
    If set to yes the first entry will be outputted as next if there is no next entry and the last entry will be outputed as first if there is no previous entry
    cycle="yes" (yes is the default value)
    cycle="no"
  • orderby
    Defines the column according to which the results are sorted. You can use third party fields here; however, with the complex field types the plugin may not work as expected.
    orderby="entry_date"
  • return_fields
    These are the fields for which the values will be outputted. Relationship, Playa and other 3rd party add-ons are NOT supported.
    return_fields="url_title|entry_id"

    Use prev_ prefix to output the value of previous entry and use next_ prefix to output the value of next entry.

    i.e.: {prev_url_title}, {next_entry_id}

    MATRIX Support:

    You need to enter Matrix fields like below.

    return_fields="entry_id|client_details:client_name:asc"

    You need to supply three segments to output Matrix Fields:

    segment1:segment2:segment3
    First segment is the field short name.
    Second segment is the Matrix column short name.
    Third segment accepts asc or desc as values and it dictates the sort order of Matrix data. Matrix values are sorted only by default Matrix sort order or in reverse order.
  • reverse_order 
    It is used to exchange the place of prev and next entries.
    reverse_order="yes"
    reverse_order="no" (no is the default value)
  • search
    Works like search parameter of exp:channel_entries tag. There is limited Playa support. You can only search through entry_id's or url_titles.
    search:price="=3200"
    search:price="=3200|1500"
    search:price="not 3200"
    search:price=">3200"
    search:price="<3200"
  • show_expired
    Filters expired entries.
    show_expired="yes"
    show_expired="no"” (no is the default value)
  • show_future_entries
    Fitlers future entries.
    show_future_entries="yes"
    show_future_entries="no" (no is the default value)
  • site_id
    Filters entries by site id.
    site_id="1"
  • sort
    Defines the sort order.
    sort="asc" (asc is the default value.)
    sort="desc"
  • status
    Filters enties by their status.
    status="open"

CAUTION

category and category_group parameters CANNOT be used at the same time.

CAUTION

channel_id and channel_name parameters CANNOT be used at the same time.

Usage

Standart Usage Example

{exp:bbr_prevnext_entry current_url_title="third_entry" category="3|5" search:name="%test" channel_id="2" order_by="entry_date" cycle="yes" return_fields="url_title"}
<a class="prev" href="{site_url}blog/{prev_url_title}/">Previous</a>  
<a class="next" href="{site_url}blog/{next_url_title}/">Next</a>

{/exp:bbr_prevnext_entry}

Return Matrix Field

{exp:bbr_prevnext_entry current_url_title="third_entry" category="3|5" search:="%test" channel_id="2" order_by="entry_date" cycle="yes" return_fields="url_title|orders:order_id:asc"}
	<span style="font-family: monospace;">Next</span> Order Summary:
	{next_orders}
	<li class="white|black">
		Order ID: {order_id}
        </li>
        {/next_orders}
{/exp:bbr_prevnext_entry}

Search Playa Field

{exp:bbr_prevnext_entry current_url_title="third_entry" category="3|5" search:clients="client_1" channel_id="2" order_by="entry_date" cycle="yes" return_fields="url_title"}
<a class="prev" href="{site_url}blog/{prev_url_title}/">Previous</a>  
	<a class="next" href="{site_url}blog/{next_url_title}/">Next</a>
{/exp:bbr_prevnext_entry}

Variables

  • empty_next
    yes, no Defines if there is an entry after this one.
     
  • empt_prev
    yes, no Defines if there is an entry after this one.
     
  • curr_
    Prefix that can accept an arbitrary string to output the current entry detail.
     
  • next_
    Prefix that can accept an arbitrary string to output the next entry detail.
     
  • prev_
    Prefix that can accept an arbitrary string to output the previous entry detail.