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.

Categories

January 26, 2009 5:24pm

Subscribe [2]
  • #1 / Jan 26, 2009 5:24pm

    Scitec

    4 posts

    I need for each entry 2 Categories (i have 2 categories grups on this webblog (houses)).

    The first category are the City (thie is the Default Category Group)
    The second category are the type (thie is the Type category Group)

    How I can now in list the categories?

    here is the code:

    {exp:weblog:entries weblog="{my_weblog}" orderby="date" sort="desc" limit="150" disable="member_data|trackbacks" rdf="off"}
    <ul>
    <li><b>(ID):</b> {id}</li>
    <li><b>City:</b> CATEGORY NO.1 (Default Category Group) </li>
    <li><b>Type:</b> CATEGORY NO.2 (Type Category Group)</li>
    <li><b>Price:</b> {price}</li>
    </ul>
    {/exp:weblog:entries}
  • #2 / Jan 28, 2009 9:31am

    silenz

    1651 posts

    Categories in weblog entries are printed with the {categories}{/categories}-variable pair because each entry can have multiple categories (even from one category group).

    To only output the categories of (a) specific category-group(s) there is a parameter to limit by group ID(s).


    So in your case, assuming the Default Category Group has the group ID 1 and the Type Category Group has the group ID 2 you’d do the following:

    {exp:weblog:entries weblog="{my_weblog}" orderby="date" sort="desc" limit="150" disable="member_data|trackbacks" rdf="off"}
    <ul>
    <li><b>(ID):</b> {id}</li>
    <li><b>City:</b> {categories show_group="1"}{category_name}{/categories}</li>
    <li><b>Type:</b> {categories show_group="2"}{category_name}{/categories}</li>
    <li><b>Price:</b> {price}</li>
    </ul>
    {/exp:weblog:entries}
  • #3 / Jan 31, 2009 5:29am

    Scitec

    4 posts

    tnx!

    This show te category but the link of the 2. category dose’nt work: zhe code:

    <b>City:</b> {categories show_group="3"}<a href="http://{path=%27webblog/index%27}" title="{category_image}">{category_image} </a> {/categories} 
    <b>Type:<b>{categories show_group="7"}<a href="http://{path=%27webblog/index%27}" title="{category_image}">{category_image}</a> {/categories}

    The first category grup works, example:

    domain.com/webblog/C73/

      -  (6 categories with ID from 68 to 73)

    But the second dosen’t, example

    domain.com/webblog/C/

      - It dosen’t shows the ID of the category, the category group have 3 categories with the id (112, 113, 114)

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

ExpressionEngine News!

#eecms, #events, #releases