Plugin:  Entry Id
Posted: 05 June 2008 04:24 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi,

I would like to present to your attention a new plugin: Entry Id.

It allows to find entry id of the entry or entry ids of several entries which have characteristics specified in parameters of the {exp:entry_id} tag.

PARAMETERS:

1) weblog - Optional. Allows you to specify weblog name.

2) category - Optional. Allows you to specify category id number
(the id number of each category is displayed in the Control Panel).

3) url_title - Optional. Allows you to specify URL title of the entry.

At least one out of “weblog”, “category” and “url_title” parameters must be defined.

4) allow_multiple_results - Optional. Allows you to specify if you want to display
entry id numbers of multiple entries (value ‘yes’) or just of one entry (value ‘no’).
Default is ‘no’. ‘limit’, ‘sort’ and ‘sort_by’ parameters are used in cases when
the value of this parameter is ‘yes’.

5) limit - Optional. Allows you to specify number of entries to be displayed.
Default value is ‘10’. Set it to ‘none’ if you want to display all entries found.

6) sort - Optional. Allows you to specify how entries found should be sorted -
ascending (value ‘asc’) or descending (value ‘desc’). Default is ‘asc’.

7) sort_by - Optional. Allows you to specify by what criterion entries found should be sorted -
by date (value ‘date’) or by title (value ‘title’). Default is ‘date’.

8) on_failure - (any string which consists from characters legal for use in ExpressionEngine’s tag parameter
values). Optional. Allows you to specify what {exp:entry_id} tag will output in case an entry
which belongs to weblog and/or is posted into category having id number and/or has url_title
as specified in parameters does not exist.

9) invalid_input - Optional. Accepts two values: “alert” and “silence”.
Default value is “silence”. If the value is “alert”, then in cases when some
parameter’s value is invalid plugin exits and PHP alert is being shown;
if the value is “silence”, then in cases when some parameter’s value
is invalid plugin finishes its work without any alert being shown.
Set this parameter to “alert” for development, and to “silence” - for deployment.

EXAMPLE OF USAGE:

If your weblog name is “my_weblog”, your category id number is “5”,
and url_title of your entry is “my_entry”, 
then the variable {entry_id_number} within {exp:entry_id}{/exp:entry_id} tag pair

{exp:entry_id weblog="my_weblog" category="5" url_title="my_entry"}
{entry_id_number}
{
/exp:entry_id}

will return entry id of the entry.

You can use variable’s {entry_id_number} output as parameter of other tag. For such use
you must add parse=“inward” parameter to {exp:entry_id} tag.

For example, code as this will work

{exp:entry_id weblog="my_weblog" url_title="my_entry" parse="inward"}
{exp
:weblog:prev_entry category="5" entry_id="{entry_id_number}"}<p><a href="{path=my_template_group/my_template}">Previous</a></p>{/exp:weblog:prev_entry}
{exp
:weblog:next_entry category="5" entry_id="{entry_id_number}"}<p><a href="{path=my_template_group/my_template}">Next</a></p>{/exp:weblog:next_entry}
{
/exp:entry_id_id}

If entry which belongs to weblog and/or is posted into category having id number and/or has url_title
as specified in parameters does not exist, then {entry_id_number} variable
by default will return nothing. In case ‘on_failure’ parameter was defined, then, in such case
the {entry_id_number} variable will output what was specified as a value of this parameter. Also {entry_id_number} variable
will return the value of ‘on_failure’ parameter in case when more than one entry was found and
‘allow_multiple_results’ parameter has the value ‘no’.

Place this tag in any of your templates.

Changelog:

- 1.2.1 // Bug fixed - simple validation of parameters values being too restrictive.
- 1.2 // Ditched support for single tag. Added parameters “allow_multiple_results”, “limit”, “sort” and “sort_by”.
- 1.1.1 // Bug fixed - output of exp:entry_id tag being different in case “weblog” or “category” or “url_title” parameter not defined and in case parameter’s value being empty string.
- 1.1 // Added invalid_input parameter.
- 1.0 // Initial release.

File Attachments
pi.entry_id_v1.2.1.zip  (File Size: 4KB - Downloads: 28)
 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 26 August 2008 09:52 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi,

I have released a version 1.1 of Entry Id plugin.

In this release parameter “invalid_input” was added. This parameter accepts two values: “alert” and “silence”. Default value is “silence”. If the value is “alert”, then in cases when some parameter’s value is invalid plugin exits and PHP alert is being shown;
if the value is “silence”, then in cases when some parameter’s value
is invalid the plugin finishes its work without any alert being shown.
Set this parameter to “alert” for development, and to “silence” - for deployment.

Since the plugin does not do comprehensive validation of parameters’ values, you cannot be absolutely sure that in cases no alert was thrown the input was really valid.

You may ask, why parameter “invalid_input” was needed there already “on_failure” parameter being available. The answer is, these parameters have different purposes. Using parameter “invalid_input” you can specify what plugin should do in case it considers some parameter’s value being invalid; using parameter “on_failure” you can specify what plugin should do in case it considers all parameters’ values being valid, but has found nothing to output.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 11 September 2008 03:46 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi,

I have released a version 1.1.1 of Entry Id plugin.

In this release a bug was fixed - output of exp:entry_id tag being different in case “weblog” or “category” or “url_title” parameter not defined and in case parameter’s value being empty string.

The bug can cause problems in cases parameters are supplied dynamically, especially when the number of dynamically supplied parameters can be different.

It is recommended to upgrade if you use the plugin in such situations.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 26 September 2008 02:51 AM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi,

I have released a version 1.2 of Entry Id plugin.

Two changes were introduced in this release:

1) Support for single tag was dropped. That is, from the version 1.2 on it will be no more possible to use single tag as here:

{exp:entry_id weblog="my_weblog" category="5" url_title="my_entry"}

 

Instead the variable {entry_id_number} within {exp:entry_id}{/exp:entry_id} tag pair should be used as here:

{exp:entry_id weblog="my_weblog" category="5" url_title="my_entry"}
{entry_id_number}
{
/exp:entry_id}

For the justification of this step it can be said that support for single tags introduces minimal simplification of coding at the cost of significant complication of plugin’s code.

2) Added parameters “allow_multiple_results”, “limit”, “sort” and “sort_by”. “allow_multiple_results” allows you to specify if you want to display entry id numbers of multiple entries (value ‘yes’) or just of one entry (value ‘no’).
Default is ‘no’. ‘limit’, ‘sort’ and ‘sort_by’ parameters are used when
the value of “allow_multiple_results” parameter is ‘yes’ to specify how many and in which order entries should be displayed.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 15 October 2008 05:30 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi,

I have released a version 1.2.1 of Entry Id plugin.

In this release a minor bug was fixed - simple validation of parameters’ values being too restrictive in case when parameter’s value is supplied by embedded template variable.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65085 Total Logged-in Users: 39
Total Topics: 82223 Total Anonymous Users: 16
Total Replies: 441920 Total Guests: 217
Total Posts: 524143    
Members ( View Memberlist )
Newest Members:  BombermanhaimtuagocsadamVeNeaDoRHildegaardhrtrulzUNFORGIVEN IIIEmmanuelYanYanTomsB