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.

List entries grouped by category heading

May 17, 2010 6:24pm

Subscribe [2]
  • #1 / May 17, 2010 6:24pm

    patrick-vibes

    63 posts

    I am developing a site for a record label and have two categories, current artist and alumini, I want to list all of the current artists at the top of the page under that category heading and the alumini underneath respectively.

    What is the easiest way of doing this?

  • #2 / May 17, 2010 6:34pm

    Wouter Vervloet

    758 posts

    Hi Patrick,

    This should certainly get your line of thoughts in the right direction:

    {assign_variable:my_weblog='artists'}
    {exp:weblog:categories weblog='{my_weblog}' style='linear' }
      <h2>{category_name}</h2>
    <p>  <ul><br />
      {exp:weblog:entries weblog='{my_weblog}' category='{category_id}'}<br />
        <li>{title}</li><br />
        {if no_results}<br />
          <li>No {category_name} yet…</li><br />
        {/if}<br />
      {/exp:weblog:entries}<br />
      </ul><br />
    {/exp:weblog:categories}

    If you’re using EE2, it’s simply replacing all the weblog references for channel.

    Greetz,
    Wouter

  • #3 / May 19, 2010 4:45pm

    patrick-vibes

    63 posts

    Cheers Wouter - definately on the right track problem is it just list category as a title above the entries but duplicates the entries underneath - it’s not showing the entries solely from that category. Below is my code:

    {exp:weblog:categories weblog="artists" style="linear"}
    <h1>{category_name}</h1>
    {exp:weblog:entries weblog="artists" dynamic="off" orderby="date" sort="asc"}
    <div class="boxgrid slideright">
    {site_url}scripts/timthumb/timthumb.php?src={exp:parse_url total=
    
    <strong>{title}</strong>
    
    <ul>
    <li><a href="http://{path=%27artist/%27}{url_title}" title="{title}">View Artist</a></li>
    </ul>
    </div>
    {/exp:weblog:entries}
    
    
    
    
    {/exp:weblog:categories}

    I have acheived the desired outcome before but only with gallery entries - I think I am overlooking something simple here.

    Any suggestions?

  • #4 / May 19, 2010 4:52pm

    patrick-vibes

    63 posts

    Cracked it - used the Grants method from here:

    http://expressionengine.com/docs/modules/weblog/category_archive.html

    All I had to do was add the category_id tag in the entries tag - working fine now.

    Close this mofo down.

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

ExpressionEngine News!

#eecms, #events, #releases