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.

Viewing Closed Posts in a Template

August 08, 2008 4:42pm

Subscribe [2]
  • #1 / Aug 08, 2008 4:42pm

    sahadeva

    14 posts

    I’d like to be able to view a blog post in my permalink template without publishing it but I can’t figure out how, exactly. I’ve configured “Live Look” to access the correct template but when I try to use it on a blog post that has a “closed” status I the error

    Parse error: syntax error, unexpected T_ELSE in /www/eh7180/public_html/brain/core/core.functions.php(637) : eval()'d code on line 66

    Is there a way to view unpublished or closed blog posts in a template rather than the simple plain text “preview” button in the edit screen?

    Thanks.

  • #2 / Aug 08, 2008 4:57pm

    Mark Bowen

    12637 posts

    Hiya,

    Yep you can definitely do this and the code below in a template should allow it :

    {exp:weblog:entries weblog="default_site" status="closed"}
    <h2>{title}</h2>
    <p>{body}<br />
    {/exp:weblog:entries}

    If you were to visit this template and your weblog has the short-name of default_site then it should show all the closed entries. The fact that you are getting that error is a bit of a tell-tale that something weird is going on. Can you post your template code here so that we can see what you have at the moment?

    You don’t possibly have any {if} conditionals on that template do you?

    Hope that helps.

    Best wishes,

    Mark

  • #3 / Aug 08, 2008 5:40pm

    sahadeva

    14 posts

    I looked at the template and did fix some incorrectly applied {if} tags (thanks!) and added [status=“closed|open”] to the weblog tag and it works like a charm (double thanks!) Woo Hoo Mark! :D

  • #4 / Aug 08, 2008 6:16pm

    Mark Bowen

    12637 posts

    Excellent news!! 😊

    Glad to have helped.

    Hope everything goes good for you.

    Best wishes,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases