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 with dynamic="off"

November 17, 2009 11:38pm

Subscribe [2]
  • #1 / Nov 17, 2009 11:38pm

    EliVZ

    37 posts

    Is there any way to specify the desired weblog entry directly (with dynamic=“off”) but show nothing at all if no entry_id is specified? I am using url segments to construct a url structure with more than the normal two levels, but I need to not show the most recent entry in a weblog if no url segment is specified.

    Here is the code I am using:

    {exp:weblog:entries weblog="documents" url_title="{segment_5}" limit="1" dynamic="off" require_entry="yes" disable="member_data|pagination|trackbacks|categories|category_fields"}

    It works great, except that if there are only four segments to the url it displays the most recent entry. Does require_entry not work with dynamic=“off”? Thanks for any help.

  • #2 / Nov 18, 2009 1:57am

    John Henry Donovan

    12339 posts

    EliVZ,

    You could use some simple condtionals to achieve what you want. You may have undesitrable results if you go off the beaten track in respect to the standard URL structure of EE.
    Let me know if this works for you

    {if segment_5 != ""}
    
    {exp:weblog:entries weblog="documents" url_title="{segment_5}" limit="1" dynamic="off" require_entry="yes" disable="member_data|pagination|trackbacks|categories|category_fields"} 
    {/exp:weblog:entries}
    
    {/if}
    
    {if segment_5 == ""}
    
    {exp:weblog:entries weblog="documents" limit="1" dynamic="off" require_entry="yes" disable="member_data|pagination|trackbacks|categories|category_fields"} 
    {/exp:weblog:entries}
    
    {/if}

    I am moving this to the How to forum as it is more appropriate there.

  • #3 / Nov 18, 2009 12:25pm

    EliVZ

    37 posts

    John-

    Yes, the conditionals should work. It sounds like the answer is no—the require_entry parameter has no effect when dynamic is off.

    Thanks for your quick response!

    Eli

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

ExpressionEngine News!

#eecms, #events, #releases