Page 1 of 1

(updated) issue with content block image switch using if/else

Posted: Fri Nov 30, 2007 12:13 pm
by forevernomad
Hi all first post,

Running all current versions of cmsms and modules with page blocks v0.1.5 on php5 apache server.

What I'm trying to do in the content block is check the content and an image is chosen based on the content, the title text is updated with the content of the block, I'm using page blocks if that's any help, but I may need this elsewhere.

The reason I'm doing it this way is so that the admin user can simply add a number to a oneline content block instead of having to go find the image and place it in the content block, just for simplicity really. There will be many blocks on one page.

Here's my code

Code: Select all

<span class="scuba_block">
       {content block="scuba" oneline="true" assign="diving"}
       {if $diving == '0'}
                  <img src="images/resorts/off/diving.jpg" alt="No Scuba Diving" />
       {else}
                  <img src="images/resorts/on/diving.jpg" alt="Scuba Diving" title="{$diving} Scuba diving classes available" />
       {/if}
</span>
The problem is that it only reads the else statement, no matter what the content is. I've tried many variations of ifs, elsifs and using eq, neq etc.

It's driving me crazy trying to get this work. I'm pretty sure it should work but I don't know why it doesn't.

Any help will be greatly appreciated.