Low Seg2Cat
This ExpressionEngine extension loops through the segments of the current URI, matches them against existing categories, and registers the matching categories as global variables, which you can use in your templates. For example, if your URI looks like this: http://domain.com/index.php/blog/news/election/, this extension will register several extra global variables. Per segment, it will register…
{segment_n_category_id}{segment_n_category_name}{segment_n_category_description}{segment_n_category_image}{segment_n_category_parent_id}{segment_n_category_group_id}
…where n is the segment number. This means if there’s a category with url_title ‘news’ and one with ‘election’, you’ll have their ids and names ready to be used in your templates. If no matching category is found for a segment, an empty string is returned. In addition to these, a final variable is also set: {segment_category_ids}, which will return an inclusive stack of all found category ids, for example: 4&12 (if category ‘news’ would have an id of 4 and ‘election’ would be 12).
What they’re saying about Low Seg2Cat
Massive shout out to @low for his seg2cat extension. —Leevi Graham
OMG I can’t live without it now. —AJ Penninga
This Seg2Cat extension is so fantastic! —Matt Everson
RSS feed Latest version: v2.3
- Added option to always set all (9) segments
- Added
{segment_n_category_group_id}