segment_n_category_parent
when viewing a child category I can display the {segment_3_category_name} fine (which is the child category name.
But how do I display the parent category name? something like segment_n_category_parent would be useful to display the parent category name
Replies
Low 13 Nov 2012 14:26
That's beyond the scope of Low Seg2Cat.
You can use the Query module to get the category name using {segment_3_category_parent_id}.
peter e 13 Nov 2012 14:46
ok. that is too bad seems like it could be useful.
Problem is I am not sure where to start
{exp:query sql="SELECT cat_name FROM exp_categories"}
Low 13 Nov 2012 14:50
Most of the time, people won't need that info. Adding it by default only adds extra weight to the page load. Better to just get it when you need it. You were starting correctly:
peter e 13 Nov 2012 14:52
{exp:query sql="SELECT cat_id as category_id, cat_name AS category_name FROM exp_categories WHERE parent_id = '{segment_3_category_parent_id}'"}
{category_name}
{/exp:query}
this is a start, doesn't quite work though.. this is displaying the children of hte parent ID, not the parent name