CB if statement usage help

12 years 6 months ago #180137 by busterocaps
CB if statement usage help was created by busterocaps
Why doesn't this work:[code type=php-brief][cb:if [cb:userfield field="cb_rank"]="Recruit"/] <img src="components/com_comprofiler/images/recruit.png" alt="Recruit" /> [/cb:if]
[cb:if [cb:userfield field="cb_rank"]="Private"/] <img src="components/com_comprofiler/mages/pvt.png" alt="Private" /> [/cb:if]
[cb:if [cb:userfield field="cb_rank"]="Corporal"/] <img src="components/com_comprofiler/images/Cprl.png" alt="Corporal" /> [/cb:if]
[cb:if [cb:userfield field="cb_rank"]="Sergeant"/] <img src="components/com_comprofiler/images/Sgt.png" alt="Sergeant" /> [/cb:if]
[cb:if [cb:userfield field="cb_rank"]="Master Sergeant"/]<img src="components/com_comprofiler/images/Master Sgt.png" alt="Master Sergeant" /> [/cb:if]
[cb:if [cb:userfield field="cb_rank"]="Lieutenant"/] <img src="components/com_comprofiler/images/LT.png" alt="Lieutenant" /> [/cb:if]
[cb:if [cb:userfield field="cb_rank"]="Captain"/] <img src="components/com_comprofiler/images/captain.png" alt="Captain" /> [/cb:if]
[cb:if [cb:userfield field="cb_rank"]="Council"/] <img src="components/com_comprofiler/images/council.png" alt="Council" /> [/cb:if][/code]

This is my code in a delimeter field tab that I have set to display on the portrait tab. I tried it this way and by doing[code type=php-brief][cb:if cb_rank="Recruit"] <img src="components/com_comprofiler/images/recruit.png" alt="alt" /> [/cb:if][/code] And that doesn't work either. Any help?

Please Log in to join the conversation.

12 years 6 months ago #180737 by busterocaps
Replied by busterocaps on topic Re: CB if statement usage help
Hey everyone, just trying to get a little help with this. :whistle:

Please Log in to join the conversation.

12 years 6 months ago - 12 years 6 months ago #180761 by pepperstreet
Replied by pepperstreet on topic Re: CB if statement usage help
Here is an example from another thread :

[cb:if cb_mycheckbox="1"]<img src="[cb:config param="live_site" /]/images/myicon.png" alt="Yes" />[/cb:if]


General help on "krileon's" page called "substitution-usage":
www.allmysocials.com/index.php?option=com_flexicontent&view=items&id=233:substitution-usage

Please Log in to join the conversation.

12 years 6 months ago - 12 years 6 months ago #180797 by busterocaps
Replied by busterocaps on topic Re: CB if statement usage help
Thanks for responding, but
[cb:if cb_rank="Recruit"]<img src="[cb:config param="live_site" /]/images/recruit.png" alt="Recruit"/>[/cb:if]
[cb:if cb_rank="Private"]<img src="[cb:config param="live_site" /]/mages/pvt.png" alt="Private"/>[/cb:if]
[cb:if cb_rank="Corporal"]<img src="[cb:config param="live_site" /]/images/Cprl.png" alt="Corporal"/>[/cb:if]
[cb:if cb_rank="Sergeant"]<img src="[cb:config param="live_site" /]/images/Sgt.png" alt="Sergeant"/>[/cb:if]
[cb:if cb_rank="Master Sergeant"]<img src="[cb:config param="live_site" /]/images/Master Sgt.png" alt="Master Sergeant"/>[/cb:if]
[cb:if cb_rank="Lieutenant"]<img src="[cb:config param="live_site" /]/images/LT.png" alt="Lieutenant"/>[/cb:if]
[cb:if cb_rank="Captain"]<img src="[cb:config param="live_site" /]/images/captain.png" alt="Captain"/>[/cb:if]
[cb:if cb_rank="Council"]<img src="[cb:config param="live_site" /]/images/council.png" alt="Council"/>[/cb:if]

Doesn't work either...:(
Odd thing, I've done this for something else, and it worked fine. I don't even get the alt text in the field.
Even odder still, checking with firebug reveals this:
<td class="titleCell">
<label id="cblabcbfv_89" for="cbfv_89">Rank Pic:</label>
</td>
<td id="cbfv_89" class="fieldCell"> </td>
Which seems to indicate CB is just ignoring the code there because the forum rank and pic show up with this code:
<td class="titleCell">
<label id="cblabcbfv_23" for="cbfv_23">Forum Ranking:</label>
</td>
<td id="cbfv_23" class="fieldCell">
Overlord
<br>
<img border="0" alt="Overlord" src="http://dogs-o-war.com/components/com_kunena/template/default/images/ranks/dow forum administrator medal custom.png">
</td>
and I would expect something similar here.

Please Log in to join the conversation.

12 years 6 months ago #180854 by pepperstreet
Replied by pepperstreet on topic Re: CB if statement usage help
Did you try a simple field output WITHOUT any IF conditions... just the field value! What happens than?
The following user(s) said Thank You: busterocaps

Please Log in to join the conversation.

12 years 6 months ago #180950 by busterocaps
Replied by busterocaps on topic Re: CB if statement usage help
If I just put the image tag in in the field, as so:
<img src="images/recruit.png" alt="Recruit" />
the picture comes up fine

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.179 seconds

Facebook Twitter LinkedIn