We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

cant get if statement work for own module

Development and Programming

Gert Timmerman's avatar
Gert Timmerman
33 posts
16 years ago
Gert Timmerman's avatar Gert Timmerman

We’ve making a module for a marketplace where users can sell their items with images. Now we want to check or a advertisment has a image, but the if statement won’t work. The value of the variable does work, we can see the value.

{img1}

will output the value. But this

{if img1 == ""}
  empty
{if:else}
  if not empty
{/if}

always output empty, even when img1 is nog empty.

What are we doing wrong?

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
16 years ago
Ingmar Greil's avatar Ingmar Greil

Aren’t you doing it exactly the wrong way around? if .. == “” means if … empty, not “if not empty”.

       
Gert Timmerman's avatar
Gert Timmerman
33 posts
16 years ago
Gert Timmerman's avatar Gert Timmerman
Aren’t you doing it exactly the wrong way around? if .. == “” means if … empty, not “if not empty”.

:D you’re right, but thats not the problem, it still doesnt work .. its always empty ..

       
Pascal Kriete's avatar
Pascal Kriete
2,589 posts
16 years ago
Pascal Kriete's avatar Pascal Kriete

Gert,

Are you calling prep_conditionals in your module?

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Beat me to it 😉

More information on Conditionals and using them in your own plugins and modules is here though.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.