Michael Rog presents

RogEE: Add-ons for ExpressionEngine 2

Category Sorted Entries 2.3.1

Like the built-in EE Category Archive, but way mo' better (i.e. with tons more variables and parameters for added control).

Once upon a time, I wanted to select all my entries with a particular category from Category Group 1, but I wanted to display them in a nested list that included only categories from Category Group 2. I also needed to display the entry_id alongside the title of the entry. The standard Category Archive Tag was close, but didn't quite cut it; So, I wrote this plugin...

n.b. Category Sorted Entries uses the PHP array_fill_keys function, so PHP 5.2+ is required.

Examples: General Use

{exp:category_sorted_entries channel="test" style="nested" show_empty="no" group_id="2" category="not 2|3"}

{category}
<h3>{category_name} ({category_id})</h3>
{/category}

{entries}
<p>{title} ({entry_id})</p>
{/entries}

{/exp:category_sorted_entries}

{exp:category_sorted_entries channel="test" style="linear" show_empty="no" group_id="not 2" entry_id="1|2|3|4|5"}

{category}
<h3>{category_name} ({category_id})</h3>
{/category}

{entries}
<p>{title} ({entry_id})</p>
{/entries}

{/exp:category_sorted_entries}

If you are using additional plugins or modules inside the listing, you may need to use parse="inward" to ensure that entry IDs and other variables are available to those tags:

{exp:category_sorted_entries channel="test" style="nested" group_id="1" parse="inward"}

 {category}
  <h3>{category_name}</h3>
 {/category}

 {entries}

  <p>{title}</p>

  <p>
  {exp:channel_ratings:rating entry_id="{entry_id}" scale="5"}
   {rating:overall:stars}
  {/exp:channel_ratings:rating}
  </p>

 {/entries}

{/exp:category_sorted_entries}

Parameters

All the parameters of the standard Category Archive Tag are available. In addition, some extra functionality is provided.

Note: The group_id, entry_id, category, and show parameters can accept multiple IDs, pipe-separated, and optionally can include a not trigger. (e.g. "1", "2|3|5", "not 2", and "not 3|4|6" are all valid.)

Variables

Entry Data Member Data Category Data
  • {title}
  • {url_title}
  • {status}
  • {site_id}
  • {channel_id}
  • {author_id}
  • {ip_address}
  • {forum_topic_id}
  • {year}
  • {month}
  • {day}
  • {entry_date format="..."}
  • {expiration_date format="..."}
  • {comment_expiration_date format="..."}
  • {recent_comment_date format="..."}
  • {comment_total}
  • {view_count_one}
  • {view_count_two}
  • {view_count_three}
  • {view_count_four}
  • {sticky}

Simple Custom Channel Fields are also available using each field's short_name. Unfortunately, at the moment, CSE parses custom field content directly from the database, so more advanced Fieldtypes (e.g. Matrix, Playa) and sub-functions (e.g. image :thumbnail) will not render fully. This will be addressed in a future release.

  • {member_id}
  • {username}
  • {screen_name}
  • {group_id}
  • {email}
  • {url}
  • {join_date format="..."}
  • {language}
  • {bday_d}
  • {bday_m}
  • {bday_y}
  • {aol_im}
  • {yahoo_im}
  • {msn_im}
  • {icq}
  • {bio}
  • {location}
  • {occupation}
  • {interests}
  • {signature}
  • {sig_img_filename}
  • {sig_img_width}
  • {sig_img_height}
  • {avatar_filename}
  • {avatar_width}
  • {avatar_height}
  • {photo_filename}
  • {photo_width}
  • {photo_height}
  • {category_id}
  • {category_name}
  • {category_url_title}
  • {category_description}
  • {category_image}
  • {group_id}
  • {parent_id}

Custom Category Fields are also available using each field's short_name.