1 of 2
1
Plugin:  Entry Categories
Posted: 06 February 2009 10:53 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1133
Joined  02-02-2007

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

Hi,

This plugin allows you to output info about categories the entry was posted into.

PARAMETERS:

1) entry_id - Required. Alows you to specify entry id number of the entry
which categories you want to display.

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

3) show - Optional. Allows you to specify category id number
(the id number of each category is displayed in the Control Panel).
You can stack categories using pipe character e.g. show=“3|6|8”. Or use “not”
(with a space after it) to exclude categories, e.g. show=“not 4|5|7”.

4) show_group - Optional. show_group - Optional. Allows you to specify category group.
You can stack group id numbers using pipe character show=“1|6|9”. Or use “not”
(with a space after it) to exclude categories, e.g. show_group=“not 5|7|11”.
Also you can use category group names as specified in control panel. You even can mix
category group names and category group id numbers using pipe symbol.

5) 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.

VARIABLES:

1) {categories_number} - outtputs number of categories the entry was posted into.

2) {category_levels_number} - outputs number of levels of categories hierarchy.

The plugin supports huge number of variables of the types outlined below (level0 is the highest level of categories, level1 is the level of subcategories of highest level, etc.; category0 is the first category of certain level, category1 is the second category, etc.):

3) {level0_category0_cat_id}, {level0_category1_cat_id}, {level0_category2_cat_id} ...
{level1_category0_cat_id}, {level1_category1_cat_id}, {level1_category2_cat_id} ...
{level99_category99_cat_id}.

4) {level0_category0_cat_name}, {level0_category1_cat_name}, {level0_category2_cat_name} ...
{level1_category0_cat_name}, {level1_category1_cat_name}, {level1_category2_cat_name} ...
{level99_category99_cat_name}.

5) {level0_category0_cat_url_title}, {level0_category1_cat_url_title}, {level0_category2_cat_url_title} ...
{level1_category0_cat_url_title}, {level1_category1_cat_url_title}, {level1_category2_cat_url_title} ...
{level99_category99_cat_url_title}.

6) {level0_category0_parent_id}, {level0_category1_parent_id}, {level0_category2_parent_id} ...
{level1_category0_parent_id}, {level1_category1_parent_id}, {level1_category2_parent_id} ...
{level99_category99_parent_id}.

7) {level0_category0_group_id}, {level0_category1_group_id}, {level0_category2_group_id} ...
{level1_category0_group_id}, {level1_category1_group_id}, {level1_category2_group_id} ...
{level99_category99_group_id}.

8) {level0_category0_cat_description}, {level0_category1_cat_description}, {level0_category2_cat_description} ...
{level1_category0_cat_description}, {level1_category1_cat_description}, {level1_category2_cat_description} ...
{level99_category99_cat_description}.

9) {level0_category0_cat_image}, {level0_category1_cat_image}, {level0_category2_cat_image} ...
{level1_category0_cat_image}, {level1_category1_cat_image}, {level1_category2_cat_image} ...
{level99_category99_cat_image}.

10) {level0_category0_subcats_number}, {level0_category1_subcats_number}, {level0_category2_subcats_number} ...
{level1_category0_subcats_number}, {level1_category1_subcats_number}, {level1_category2_subcats_number} ...
{level99_category99_subcats_number}.

EXAMPLE OF USAGE:

{exp:entry_cats entry_id="3049" site="1"}

{if category_levels_number 
== 2}

{level0_category0_cat_name}
{level1_category0_cat_name}

{
/if}

{
/exp:entry_cats} 
 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 13 February 2009 07:16 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1133
Joined  02-02-2007

Hi,

I released version 1.1 of Category Info plugin.

In this release a bug - variables present only in conditionals not being parsed - was fixed.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 29 June 2009 06:54 AM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1133
Joined  02-02-2007

Hi,

I released version 1.2 of Entry Categories plugin.

In this release a piece of code was added which finds all parent categories which for some reason were not listed in exp_category_posts table among categories the entry was posted into (such thing happens!).

Everyone who uses this plugin is recommended to upgrade.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 03 August 2009 07:55 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Rank
Total Posts:  73
Joined  01-19-2008

Hi Laisvunas,

What is the difference with the {weblog:entries} {categories} variable?

Profile
 
 
Posted: 06 August 2009 09:29 AM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1133
Joined  02-02-2007

Hi ron00nor,

The difference with the {weblog:entries} {categories} variable consists in:

1) {weblog:entries} {categories} variable does not allow to differenciate between levels of categories;

2) {weblog:entries} {categories} variable does not allow to output subcategories number for each category.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 11 August 2009 03:22 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Avatar
Rank
Total Posts:  47
Joined  06-14-2008

Laisvunas, FYI, my server log has the following error for this plugin:

Undefined offset:  -1  on line 262 
 Signature 

Michel Godts eDesign | Website design, consulting, and solutions, Rochester, NY

Profile
 
 
Posted: 12 August 2009 01:32 AM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1133
Joined  02-02-2007

Hi Michel,

In order to debug it should be possible for me to reproduce the issue; so, provide the portion of your code which causes that error message.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 12 August 2009 09:54 AM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  47
Joined  06-14-2008

Laisvunas, after doing some testing, it looks like just to have a minimal code like below will generate a PHP notice warning on the server.

Server: Linux/Apache, PHP 5.2.9

{exp:weblog:entries weblog="pages|welcome" limit="1" disable="categories|member_data|pagination|trackbacks"}
  {exp
:entry_cats entry_id="{entry_id}" invalid_input="alert"}
    
<p>
    
Entry ID{entry_id}<br/>
    
Level0 ID{level0_category0_cat_id}<br/>
    
Level0 Cat Name{level0_category0_cat_name}<br/>
    
Level1 ID{level1_category0_cat_id}<br/>
    
Level1 Cat Name{level1_category0_cat_name}<br/>
    
Level2 ID{level2_category0_cat_id}<br/>
    
Level2 Cat Name{level2_category0_cat_name}<br/>
    </
p>
  
{/exp:entry_cats}
{
/exp:weblog:entries} 

The above gives me this server log notice:

PHP Notice:  Undefined offset: -1  on line 262 

If one of the value cannot be retrieved:

PHP Notice:  Undefined index2  on line 386 

Let me know if you need anything else.

 Signature 

Michel Godts eDesign | Website design, consulting, and solutions, Rochester, NY

Profile
 
 
Posted: 13 August 2009 01:26 AM   [ Ignore ]   [ # 8 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1133
Joined  02-02-2007

Hi Michel,

checked your code and found that on my EE installation it works perfectly. I do not know what to suggest.

Perhaps it is worth to try to decouple exp:weblog:entries tag from exp:entry_cats tag, i.e. to try and see if the code

{exp:weblog:entries weblog="pages|welcome" limit="1" disable="categories|member_data|pagination|trackbacks"}
{entry_id}
{
/exp:weblog:entries} 

and the code

{exp:entry_cats entry_id="my_entry_id" invalid_input="alert"}
    
<p>
    
Entry ID{entry_id}<br/>
    
Level0 ID{level0_category0_cat_id}<br/>
    
Level0 Cat Name{level0_category0_cat_name}<br/>
    
Level1 ID{level1_category0_cat_id}<br/>
    
Level1 Cat Name{level1_category0_cat_name}<br/>
    
Level2 ID{level2_category0_cat_id}<br/>
    
Level2 Cat Name{level2_category0_cat_name}<br/>
    </
p>
  
{/exp:entry_cats} 

works as expected.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 13 August 2009 07:03 AM   [ Ignore ]   [ # 9 ]  
Grad Student
Avatar
Rank
Total Posts:  47
Joined  06-14-2008

I tried your suggestion. It is still giving the same errors.

My client’s EE installation is 1.6.7, Build 20090515. What is yours?

 Signature 

Michel Godts eDesign | Website design, consulting, and solutions, Rochester, NY

Profile
 
 
Posted: 13 August 2009 08:43 AM   [ Ignore ]   [ # 10 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1133
Joined  02-02-2007

Mi Michel,

My EE installation is 1.6.8, Build 20090723.

I doubt that version and build might have any influence here.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 15 August 2009 08:10 AM   [ Ignore ]   [ # 11 ]  
Grad Student
Avatar
Rank
Total Posts:  47
Joined  06-14-2008

Right. Upgraded to latest version/built. Didn’t make a difference.
What about your server/PHP? This is what we run: Linux/Apache, PHP 5.2.9.

You understand that these errors only show on the server log, right? (Have you checked your server log?) These warnings do not influence how the plugin works.

 Signature 

Michel Godts eDesign | Website design, consulting, and solutions, Rochester, NY

Profile
 
 
Posted: 16 August 2009 05:39 AM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1133
Joined  02-02-2007

Hi Michel,

Grab the version 1.2.1 - I fixed the bug.

Thanks for reporting.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 16 August 2009 06:38 AM   [ Ignore ]   [ # 13 ]  
Grad Student
Avatar
Rank
Total Posts:  47
Joined  06-14-2008

Thank you very much, Laisvunas.

It works like a charm now.

 Signature 

Michel Godts eDesign | Website design, consulting, and solutions, Rochester, NY

Profile
 
 
Posted: 28 August 2009 10:13 AM   [ Ignore ]   [ # 14 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  232
Joined  06-12-2002

Laisvunas,

I’m in dire need of this plugin accepting url_title instead of entry_id to identify the entry to grab. Is that at all do-able? I’m way stressed, trying to get a deadline done, and just realized that i can’t get this working as is.

It seems like it would bring it more in line with your other plugins, most of which will accept either identifier.

Thanks in advance for your time. smile

Adrienne

Profile
 
 
Posted: 28 August 2009 01:24 PM   [ Ignore ]   [ # 15 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1133
Joined  02-02-2007

Hi Adrienne,

Use Entry Categories plugin together with Entry Id plugin:

{exp:entry_id weblog="my_weblog" url_title="my_entry" parse="inward"}

{exp
:entry_cats entry_id="{entry_id_number}" site="1"}

{if category_levels_number 
== 2}

{level0_category0_cat_name}
{level1_category0_cat_name}

{
/if}

{
/exp:entry_cats} 

{
/exp:entry_id} 
 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 28 August 2009 01:42 PM   [ Ignore ]   [ # 16 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  232
Joined  06-12-2002

Laisvunas,

Thanks, that helps a lot!

Adrienne

Profile
 
 
Posted: 01 September 2009 05:19 PM   [ Ignore ]   [ # 17 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  330
Joined  02-05-2009

Any ideas why this isn’t working for me?

{exp:entry_id url_title="{segment_3}" parse="inward" }

{exp
:entry_cats entry_id="{entry_id_number}" show="not 1|10|11|12|40|14"}

{if category_levels_number 
== 1}

{level0_category0_cat_name}

{
/if}

{if category_levels_number 
== 2}

{level1_category0_cat_name}

{
/if}

{
/exp:entry_cats} 

{
/exp:entry_id} 

thx!

 Signature 

TucsonSentinel.com - we’re watching Tucson

Profile
 
 
Posted: 02 September 2009 05:28 AM   [ Ignore ]   [ # 18 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1133
Joined  02-02-2007

Check if the tag exp:entry_id and the tag exp:entry_cats has correct output when used separately.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
   
1 of 2
1