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 Category Name

October 12, 2011 7:00am

Subscribe [4]
  • #1 / Oct 12, 2011 7:00am

    jemes

    7 posts

    I have a page that displays a list of categories, when a category is clicked it goes to a new page that lists related entries to that category.

    This all work nicely but I would like to display the Category Title on the related entries page and I’m not sure the best way to achieve this?

    Thanks

    Jemes


    List of Categories

    {exp:channel:categories channel="web_links"}
     <a href="http://{path=web-links/index}">{category_name}</a>
    {/exp:channel:categories}

    List of Related Entries

    {exp:channel:entries channel="web_links" orderby="date" cache="no" refresh="120" paginate="bottom"}
     <h1>{title}</h1>
        {web_links_description}
    {/exp:channel:entries}
  • #2 / Oct 12, 2011 8:55am

    Boyink!

    5011 posts

    {exp:channel:entries channel="web_links" orderby="date" cache="no" refresh="120" paginate="bottom"}
     <h1>{title}</h1>
        {web_links_description}
     
    {categories}{category_name}{/categories}
    
    {/exp:channel:entries}
  • #3 / Oct 12, 2011 9:02am

    Sue Crocker

    26054 posts

    Thanks for the assist, Mike.

    jemes, does the info from Mike help?

  • #4 / Oct 12, 2011 9:32am

    jemes

    7 posts

    Thanks Mike

    That works but I only want the Category Title displayed once before the start of the entries loop.

    Is this possible?

    Thanks for your support

    Jemes

  • #5 / Oct 12, 2011 11:18am

    Boyink!

    5011 posts

    Ab - maybe the exp:category:heading tag would work better then.

  • #6 / Oct 12, 2011 12:18pm

    Design by Front

    106 posts

    You could also try

    {exp:channel:entries channel="web_links" orderby="date" cache="no" refresh="120" paginate="bottom"}
    {if count == 1}
     {categories}{category_name}{/categories}
    {/if}
     <h1>{title}</h1>
     {web_links_description}
    {/exp:channel:entries}

    Best,
    Chuck

  • #7 / Oct 12, 2011 2:35pm

    Sue Crocker

    26054 posts

    Thanks for the assist, Chuck.

    jemes - for more information on using the Channel Category Heading see the following page from the docs:

    http://ellislab.com/expressionengine/user-guide/modules/channel/category_heading.html

  • #8 / Oct 13, 2011 4:34am

    jemes

    7 posts

    Thanks Mike.

    That works perfectly.

  • #9 / Oct 13, 2011 6:41am

    Sue Crocker

    26054 posts

    Glad that info from Mike helped. Feel free to start a new thread if you have any more questions.

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

ExpressionEngine News!

#eecms, #events, #releases