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.

Display parent category and child separately

July 28, 2010 11:43am

Subscribe [2]
  • #1 / Jul 28, 2010 11:43am

    IDF MARKETING

    23 posts

    How can I display the parent category and child category separately using:

    http://ellislab.com/expressionengine/user-guide/modules/channel/variable_pairs.html#var_categories

    I tried using limit=1 which outputs the parent name but how would I then show the child?

    Thanks in advance

  • #2 / Jul 28, 2010 5:35pm

    Ingmar

    29245 posts

    What version and build of EE are you using? Can you show us a little more of your code?

  • #3 / Jul 29, 2010 5:31am

    IDF MARKETING

    23 posts

    Hi Ingmar,

    Code below - commented on my category areas

    <table class="spec">
    <tr class="odd">
    <td class="table-text-left">
    <strong>Make</strong>
    </td>
    <td class="table-text-right">
    {categories limit="1"}<!--This gets the parent category by limiting it to 1-->
    {category_name}
    {/categories}
    </td>
    </tr>
    <tr class="even">
    <td class="table-text-left">
    <strong>Model - {my_kat}</strong>
    </td>
    <td class="table-text-right">
    <!--This is where I need to display the child of the parent as per the above for example if parent is Dodge then the child is Charger-->
    </td>
    </tr>
    <tr class="odd">
    <td class="table-text-left">
    <strong>Variant</strong>
    </td>
    <td class="table-text-right">
    {variant}
    </td>
    </tr>
    <tr class="even">
    <td class="table-text-left">
    <strong>Body Type</strong>
    </td>
    <td class="table-text-right">
    {body_type}
    </td>
    </tr>
    <tr class="odd">
    <td class="table-text-left">
    <strong>Transmission</strong>
    </td>
    <td class="table-text-right">
    {transmission}
    </td>
    </tr>
    <tr class="even">
    <td class="table-text-left">
    <strong>Fuel Type</strong>
    </td>
    <td class="table-text-right">
    {fuel_type}
    </td>
    </tr>
    <tr class="odd">
    <td class="table-text-left">
    <strong>Colour</strong>
    </td>
    <td class="table-text-right">
    {colour}
    </td>
    </tr>
    <tr class="even">
    <td class="table-text-left">
    <strong>Year</strong>
    </td>
    <td class="table-text-right">
    {year}
    </td>
    </tr>
    <tr class="odd">
    <td class="table-text-left">
    <strong>Mileage</strong>
    </td>
    <td class="table-text-right">
    {mileage} (miles)
    </td>
    </tr>
    <tr class="even">
    <td class="table-text-left">
    <strong>Engine Size</strong>
    </td>
    <td class="table-text-right">
    {engine_size}
    </td>
    </tr>
    <tr class="odd">
    <td class="table-text-left">
    <strong>No. Of Doors</strong>
    </td>
    <td class="table-text-right">
    {doors}
    </td>
    </tr>
    <tr class="even">
    <td class="table-text-left">
    <strong>No. Of Owners</strong>
    </td>
    <td class="table-text-right">
    {owners}
    </td>
    </tr>
    </table>
  • #4 / Jul 29, 2010 5:37am

    IDF MARKETING

    23 posts

    1.6.9 version in use

  • #5 / Jul 29, 2010 7:21pm

    Brandon Jones

    5500 posts

    You could use two {categories} pairs, the first with the show parameter excluding children, and the second with the show parameter excluding parents. Does that help?

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

ExpressionEngine News!

#eecms, #events, #releases