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.

require_entry only shows no results

August 18, 2011 11:30am

Subscribe [2]
  • #1 / Aug 18, 2011 11:30am

    I’m using the Category URL indicator with Category URL Titles and trying to stop non-existent category names from outputting any results.

    Currently attempting to display a non-existent category is displaying all the entries from that channel. I’d rather have the page show a custom message.

    I made a thread here about it:

    http://ellislab.com/forums/viewthread/197068/

    ... but for the life of me I cannot get require_entry=“yes” to work. It simply shows my No Results message for all categories now, even the ones that do exist.

    Is there something I’m overlooking or is this the normal operation with Category URL Titles? If so, if there a workaround?

  • #2 / Aug 18, 2011 1:28pm

    I the page working now by another member’s suggestion, but would still like to know whether require_entry can somehow be used in this situation.

  • #3 / Aug 18, 2011 10:34pm

    Dan Decker

    7338 posts

    Hi businessessentials,

    Your frustration might be because the require_entry parameter applies to {exp:channel:entries} tag. When dealing with {exp:channel:categories} you may have some success using the show_empty parameter. Unless I misunderstand what you are trying to do?

    Feel free to include relevant template code in your anytime you need assistance with tag questions.

    Cheers!

  • #4 / Aug 18, 2011 11:55pm

    I was trying to use require_entry parameter with {exp:channel:entries} tag, but when I add it I cannot see any results at all.

  • #5 / Aug 19, 2011 12:24am

    Dan Decker

    7338 posts

    businessessentials,

    You mention using category titles above. The require_entry parameter is looking for either a Channel entry ID or Channel entry URL title specifically. Can you provide an example of a URL that is returning no results? Also provide an explanation of each URL segment.

    Cheers,

  • #6 / Aug 19, 2011 10:10am

    URLs are structured like:

    http://example.com/news/category/category-name-here

    And the code is like:

    {exp:channel:entries
        channel="news"
        category="{segment_3}"
        dynamic="yes"
        require_entry="yes"  
    }
    
        {if no_results}No Results!{/if}
        
        {title}
    
    
    {/exp:channel:entries}

    Without the require_entry it works but non-existent category entries attempt to display.

    But when I add it in, even existing category entries fail to display anything at all.

    Am I correct in thinking the require_entry is supposed to simply stop non-existing categories only from attempting to display entries?

  • #7 / Aug 19, 2011 10:54am

    Dan Decker

    7338 posts

    businessessentials,

    The require_entry parameter has no effect on categories. It’s not related to category use in ExpressionEngine. It’s expressly for Channel Entries. By using that parameter, you are telling ExpressionEngine to look in the URL for the title of an entry in the channel you are calling. So it only works with regards to my-entry-title not my-category-title. To work with categories, you would use the {category} tag pair inside your {exp:channel:entries} loop or use the separate {exp:channel:categories} loop.

    Does that help clarify?

    Cheers,

  • #8 / Aug 19, 2011 10:59am

    It certainly does, thank you for all your help.

  • #9 / Aug 19, 2011 11:05am

    Dan Decker

    7338 posts

    businessessentials,

    Thank you for using ExpressionEngine! Feel free to start another thread anytime you have questions or issues.

    Cheers!

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

ExpressionEngine News!

#eecms, #events, #releases