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.

If statement doesn't work within plugin code

May 23, 2012 8:12am

Subscribe [2]
  • #1 / May 23, 2012 8:12am

    alexche

    1 posts

    I have a plugin that displays facebook feed on a page.
    Whenever there’s a picture attached to the post, it should display it in the feed on my page.
    Here’s the code:

    {exp:fbooker:data who="username" limit="15" pics="yes"}
       {dateAdded}
       {pic} {user} 
       {post} {if photo != ""} {photo} {/if} 
    
    
    {/exp:fbooker:data}

    The if statement doesn’t seem to be working at all. If I remove it, I get a 150px blank space if the post doesn’t have a picture attached.

    {photo} returns the path to the image, I am able to display it anywhere outside the if statement.

    Any idea why the if statement doesn’t work as it’s supposed to?

  • #2 / May 24, 2012 10:21pm

    ChiefAlchemist

    913 posts

    I’m not sure but it sounds like an issue with the plugin to me. It’s not EE.

    What you can try as a work around is to wrap the whole bit in div called (for example) id = “facebook-wrap”. Then use jQuery to find the img’s within that id where the src is blank. If it’s blank use .addClass to add a class. Make that class display = none.

    Let me know if this works out for you.

    Mark

  • #3 / May 27, 2012 12:01pm

    alexche

    1 posts

    Yes, the work around worked. I was just curoius as to why EE wouldn’t accept my code. I couldn’t find anything unusual in the plugin code.

    Anyways, thank you much for your time and suggestion 😊

  • #4 / May 27, 2012 1:03pm

    ChiefAlchemist

    913 posts

    I have not yet dabbled in plugin dev but if it’s better the plugin tags then it’s a plugin issue, not an EE issue. Evidently, I would presume, the plugin isn’t designed to do what you wanted it to do. Duh 😊

    Glad the work around worked.

    Good luck.

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases