We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Item Finder

Development and Programming

Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.

This plugin allows you to find needed item by parsing numbers in url_titles.

PARAMETERS:

1) item - Required. Possible values are integers starting from “1”.

2) category - Optional. Allows you to specify category id. Pipe character and “not” aren’t supported.

3) weblog - Optional. Allows you to specify weblog short name. Pipe character and “not” aren’t supported.

4) site - Optional. Default value is “1”.

5) orderby - Optional. Possible values are “date” and “title”. Default is “date”. Use this parameter together with “if_not_found” parameter.

6) if_not_found - Optional. Possible values are “none”, “first” and “last”. If the value is “none”, then in case needed item was not found, the variable {item_finder_url_title} will output nothing. If the value is “first”, then in such case it will output url_title of the first entry. If the value is “last”, then in such case it will output url_title of the last entry.

VARIABLES:

1) {item_finder_url_title} - will output url_title of the entry containing item specified in parameters.

EXAMPLE OF USAGE:

Say you have weblog “articles” in which there are several entries posted into category “technical”, whose url_titles are as follows:

articles_15_20 article_21 article_22_24 articles_24_26 article_27

Now suppose you need to display entry containing article 25.

In order to achieve this you will need to write such code:

{exp:item_finder weblog="articles" category="technical" item="25" orderby="date" if_not_found="first" parse="inward"}
{redirect="my_template_group/my_template/{item_finder_url_title}/"}
{/exp:item_finder}

{item_finder_url_title} will output “articles_24_26” and needed entry will be displayed.

INCORRECTLY FORMED URL TITLES

Some url_titles are considered incorrectly formed and are not parsed by the plugin. Those are url_titles in which:

1) some number is equal to zero

2) some number contain leading zero

3) there are more than two numbers

4) second number is bigger than the first

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.