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: From To Converter

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.

Hi,

I would like to present to your attention a new plugin - From To Converter. It is designed to help in dealing with ranges of entries using exp:weblog:entries tag.

exp:weblog:entruies tag has two pairs of parameter which allow to specify a range of entries:

1) “entry_id_from” and “entry_id_to”

2) “start_on” and “stop_before”

Using of parameters “entry_id_from” and “entry_id_to” has some advantages: it easy to submit them using some form and pass using URL segments. But these parameters also has some disadvantage: the numeric value of “entry_id_from” parameter must be bigger than numeric value of “entry_id_to” parameter. This means that having the range of entries as this:

“Title 1”, entry_id: 1284, entry date: 01/10/07 12:02 pm; “Title 2”, entry_id: 1285, entry date: 01/10/07 02:50 pm; “Title 3”, entry_id: 1259, entry date: 02/01/08 03:11 pm; “Title 4”, entry_id: 1260, entry date: 02/03/08 11:32 am;

we cannot output these entries by specifying entry_id of the first and entry_id of the last entry; we should use “start_on” and “stop_before” parameters instead.

But using of “start_on” and “stop_before” parameters has some diadvantages: it is complicated to submit them using forms and pass using URL segments.

Here comes From To Converter plugin. It converts “entry_id_from” and “entry_id_to” to “start_on” and “stop_before”. That is, you submit entry_id of the first entry and entry_id of the last entry to the plugin and the plugin outputs the values of “start_on” and “stop_before” parameters to exp:weblog:entries tag.

PARAMETERS:

1) entry_id_from - Required. Use to specify entry_id of the first entry in range.

2) entry_id_to - Required. Use to specify entry_id of the last entry in range.

3) parse - Required. Should have the value “inward”.

VARIABLES:

1) start_on - outputs the value of “start_on” parameter of exp:weblog:entries tag.

2) stop_before - outputs the value of “stop_before” parameter of exp:weblog:entries tag.

EXAMPLE OF USAGE:

{exp:from_to entry_id_from="1284" entry_id_to="1260" parse="inward"}
{exp:weblog:entries weblog="my_weblog" category="my_category" start_on="{start_on}" stop_before="{stop_before}" sort="asc" limit="20" dynamic="off"}
{title}

{/exp:weblog:entries}
{/exp:from_to}
       

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.