All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

segment_n_category_parent

peter e 13 Nov 2012 14:15 problem, rejected

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

  1. 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}.

  2. 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"}

  3. 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:

    {exp:query sql="SELECT cat_name FROM exp_categories WHERE cat_id = '{segment_3_category_parent_id}'"} 
    Parent name: {cat_name}
    {/exp:query}

    peter e 13 Nov 2012 14:54

    that is the stuff!!! thanks so much for your quick reply

  4. 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