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.

exp:weblog:entries and conditional status= parameter?

June 20, 2009 7:38pm

Subscribe [1]
  • #1 / Jun 20, 2009 7:38pm

    ms

    274 posts

    Seems I’m stuck somehow.

    I’d like to show a list of the 5 most recent weblog entries, but here is the catch: If the viewer is logged_in, the list should contain weblog entries with status ‘open’ as well as ‘private’. If the viewer isn’t logged in, he should not see entries with the status=“private”, but still see 5 entries listed. Sounds easy enough. But the following conditional (and some variations) don’t seem to work (parsing order?):

    {exp:weblog:entries weblog="weblog" status="open{if logged_in}|private{/if}" ... limit="5"}
    ...
    {/exp:weblog:enties}

    Of course, I can use a conditional inside the exp:weblog:entries loop to check if status==“private” - but then I will end up with less than 5 entries if the contitional fires. Using a different weblog or a category as a trigger for the private content is not an option, should be working on the status parameter.

    First question: Is it just me doing something wrong or what is stopping the conditional to work in the exp:weblog:entries tag?
    Second question: What would be the best practice to reach my goal (searched through 50+ pages of posts without luck)?

    Thanks a lot
    -Markus

  • #2 / Jun 20, 2009 8:09pm

    Lisa Wess

    20502 posts

    You can’t use conditionals arounda parameter like that; you will likely want to surround the entire weblog entries tag with if logged in, and a separate weblog entries tag with if logged out, with the appropriate statuses.

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

ExpressionEngine News!

#eecms, #events, #releases