EllisLab text mark
Advanced Search
     
If statement doesn’t work within plugin code
Posted: 23 May 2012 08:12 AM   [ Ignore ]
Joined: 2012-05-23
2 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}
   
<img src="{pic}" /> {user} 
   {post} {if photo 
!= ""<img src="{photo}" /> {/if} <br /><br />
{/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?

 
Posted: 24 May 2012 10:21 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2008-11-19
1070 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

 
Posted: 27 May 2012 12:01 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2012-05-23
2 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 smile

 
Posted: 27 May 2012 01:03 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Joined: 2008-11-19
1070 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 smile

Glad the work around worked.

Good luck.

Mark