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.

Show once

December 07, 2011 11:07am

Subscribe [2]
  • #1 / Dec 07, 2011 11:07am

    Oliver Ker

    7 posts

    Hi,

    Is it possible to only show the category only once if returned.
    So if there is a list of categories that are gathered from a list of entries, but then only show it once if present - or is there a better way than I am doing now?
    Here is the page you can see list of categories, but only need to show once if it exists
    http://www.pexa.co.uk/en/testing/

    {exp:channel:entries channel='sectors' orderby="title" sort="asc" status="open|hidden" disable="category_fields|member_data|pagination"}
    
    <div class="{url_title}">
    <h1><a href="http://{site_url_wlc}{segment_1}/{url_title}">{title}{/if}</a></h1>
    
    {cf_image}<a href="http://{title_permalink">{exp:ce_img:single src="{mt_image}" width="118" max="118" crop="no" allow_scale_larger="yes" alt="{title}"}</a>{/cf_image}
    
    <div class="desc">{cf_description_{language_code}}</div>
    
    <ul>
    {exp:playa:parents field="cf_product_related" order_by="group" sort="asc" disable="category_fields|member_data|pagination"}
    {categories limit="1" }<li><a href="http://{site_url_wlc}{segment_1}/{child:url_title}/{category_url_title}">{category_name}</a></li>{/categories}
    {/exp:playa:parents}
    </ul>
    
    {/exp:channel:entries}

     

  • #2 / Dec 08, 2011 11:57am

    Kevin Smith

    4784 posts

    Hi Oliver,

    I’m not sure I understand. Looking at the page at the link provided, it looks like within each main heading, each category is only displayed once.

    Are you referring to the categories being displayed based on entries retrieved by Playa? If so, the best place to get help with that would be to work with the developer of Playa, Pixel & Tonic.

    If I’ve misunderstood your question, please let me know!

  • #3 / Dec 08, 2011 1:51pm

    Oliver Ker

    7 posts

    Thanks Kevin, I since fixed it using jquery, but would be interested if it can be done via EE?
    All playa is doing is returning the related articles via playa then uses EE category tags to show the category related to that article? I have taken away the jquery so the link looks like it did before.

    Can it be done? if not never mind ill stick to the jquery.

  • #4 / Dec 09, 2011 6:35pm

    Kevin Smith

    4784 posts

    Actually, the category tags inside the Playa tags would be processed by Playa, so any functionality you’re looking for there would need to come from that add-on. Have you checked with Pixel & Tonic on this one?

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

ExpressionEngine News!

#eecms, #events, #releases