ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Is it possible to repeat subcategories in a Category group?

December 16, 2010 2:19pm

Subscribe [3]
  • #1 / Dec 16, 2010 2:19pm

    cirrusmt

    3 posts

    We have a category group with about 60 categories. The main thing I wish to accomplish is an index page that prints out a category tree. However, we would like to repeat some sub-categories underneath other parent categories.

    CATEGORY 1
    - subcat alpha
    - subcata beta

    CATEGORY 2
    - subcat gamma
    - subcat alpha << repeat

    CATEGORY 3
    - subcat delta
    - subcat beta << repeat

    The issue I’m running into is that I cannot create categtories with same Category URL Title when I’m building the category tree;
    i.e. I cannot create another subcat_alpha

    How I can accomplish the task of including the reapeated subcategories underneath other parent categories?

    I was thinking of creating duplicate similarly named subcategories with different Category URL Titles
    ex: subcat_alpha and subcat_alpha2

    but that seems awkward because we would have to remember to keep double or triple tagging our articles with the ‘duplicate’ subcategories.

    So is there a way to alter the output of the category tree in order to display our repeated subcategories.

    thank you in advance for any tips or guidance

    [Mod Edit: Moved to the CodeShare Corner forum]

  • #2 / Dec 17, 2010 3:31am

    John Henry Donovan

    12339 posts

    cirrusmt,

    What version and build are you using?
    Are you using any add-ons?

    How are you building this category tree?
    Are you using the categories tag?

    {exp:channel:categories channel="default"}
    
    <a href="http://{path=channel/index}">{category_name}</a>
    
    {/exp:channel:categories}

    Do these sub categories appear under the parent category in your control panel?

  • #3 / Dec 17, 2010 11:27am

    cirrusmt

    3 posts

    Hi John,

    What version and build are you using?   EE v2.1.0

    Are you using any add-ons?   Yes but not for category management.


    How are you building this category tree?  Are you using the categories tag?
    No I’m using the query tag.  because of a formatting issue I was running into.

    {exp:query sql="SELECT cat_name as category_name, cat_url_title as category_url_title FROM exp_categories WHERE parent_id = 778 or cat_id =778 order by cat_id"}
    <li>
        <a href="http://{path=spec_sheets/category/{category_url_title}}">{category_name}</a>
    </li>
    {/exp:query}


    Do these sub categories appear under the parent category in your control panel?
    Yes they do. The initial subcategories appear but again what I wish to do is repeat them under other parent categories when I print out the category tree on a public index page.


    Thanks,

  • #4 / Dec 18, 2010 2:34pm

    Greg Salt

    3988 posts

    Hi cirrusmt,

    I’ve moved this thread to the CodeShare Corner forum for you since it’s more appropriate here. You would have to manually build this tree and using the Query module is probably the easiest way to do so. With regards to the category naming I’m a bit unclear about what it is you are trying to do. A category can’t be in two groups but what you could do is to make Category 2 and Category 3 sub-categories of Category 1. The logical parents/grandparents would then be correct but exactly how they would be displayed on the frontend would be down to you. Can you explain what it is that you are trying to do when adding categories to your data?

    Cheers

    Greg

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases