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

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
forevernomad
Forum Members
Forum Members
Posts: 19
Joined: Fri Nov 30, 2007 12:01 pm

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

Post 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.
Last edited by forevernomad on Fri Nov 30, 2007 2:55 pm, edited 1 time in total.
Post Reply

Return to “CMSMS Core”