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.

Problem displaying content with no category

July 06, 2008 10:08am

Subscribe [1]
  • #1 / Jul 06, 2008 10:08am

    Brandon C.

    43 posts

    Here’s the code in question:

    {exp:weblog:entries disable="member_data|pagination|trackbacks"}
    
    {categories}
    
    {if category_name == "about"}
        
       /_assets/pic_about_1.jpg
    
    {if:elseif category_name == "tickets"}
        
       /_assets/pic_tickets_1.jpg
    
    {if:elseif category_name == "support"}
        
       /_assets/pic_support_1.jpg
    
    {if:elseif category_name == "touring"}
        
       /_assets/pic_touring_1.jpg
    
    {if:elseif category_name == "press"}
    
       /_assets/pic_press_1.jpg
    
    {if:elseif category_name == "productions"}
        
       /_assets/pic_about_1.jpg
    
    {if:else}
    
       /_assets/pic_about_1.jpg
    
    {/if}
    
    {/categories}
    
    {/exp:weblog:entries}

    So basically what I’m trying to do is say “if the category is x, display this picture. If there isn’t a category assigned, display this one other one.”

    It’s working for all the pages that do have categories assigned, just not the unassigned ones.

    Could this be a bigger problem with how I have my categories setup?

  • #2 / Jul 06, 2008 10:10am

    Brandon C.

    43 posts

    I also tried it the other way, where instead of the elseif statements, I just put..

    {if category_name = ""}
    
       /_assets/pic_about_1.jpg
    
    {/if}

    ..which didn’t work either. Am I maybe missing something with how categories work?

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

ExpressionEngine News!

#eecms, #events, #releases