Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] using multiple if statements not possible?

  • darranwil
  • darranwil
  • OFFLINE
  • Posts: 28
  • Thanks: 1
  • Karma: 0
9 years 1 month ago - 9 years 1 month ago #270021 by darranwil
Attempting to use this code to display badges off of a multcheck list.

[cb:if cb_certifications_general="QRC_Badge"]<img src="images/badges/badge1.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="Fork_Lift_Certified"]<img src="images/badges/badge2.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="Emergency_Response_Team"]<img src="images/badges/badge3.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="Fall_Protection"]<img src="images/badges/badge4.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="Plasa_Member"]<img src="images/badges/badge5.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="CPR_Certified"]<img src="images/badges/badge6.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="Health_&_Safety_Committie_Member"]<img src="images/badges/badge7.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="ETCP_Rigger_Arena"]<img src="images/badges/badge8.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="ETCP_Rigger_Theatre"]<img src="images/badges/badge8.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="ETCP_Electrictian"]<img src="images/badges/badge9.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="Certified_Crane_Operator"]<img src="images/badges/badge10.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="Emergency_Medical_Technician"]<img src="images/badges/badge11.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="Certified_Security_Officer"]<img src="images/badges/badge12.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="IATSE_Member"]<img src="images/badges/badge13.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="BBB_Member"]<img src="images/badges/badge14.png" alt="badge symbol" height="75" width="25" />[/cb:if]
[cb:if cb_certifications_general="First_Aid"]<img src="images/badges/badge15.png" alt="badge symbol" height="75" width="25" />[/cb:if]



Just renders blank... I've checked the Use Cases, the Primer, the 1.9 Manual. I cannot find a reference to make this work anywhere. I've found previous postings with this same question and no resultion. Not possible?
Last edit: 9 years 1 month ago by krileon.

Please Log in or Create an account to join the conversation.

  • darranwil
  • darranwil
  • OFFLINE
  • Posts: 28
  • Thanks: 1
  • Karma: 0
  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 1 month ago #270093 by krileon
Replied by krileon on topic using multiple if statements not possible?
Your usage will work for a single select, but you're using a multi-checkbox field. So you'll have to use REGEX as the values are stored as VALUE1|*|VALUE2|*|VALUE3, etc.. The below should work for example.

FROM:
[cb:if cb_certifications_general="QRC_Badge"]<img src="images/badges/badge1.png" alt="badge symbol" height="75" width="25" />[/cb:if]
TO:
[cb:if cb_certifications_general=~"/QRC_Badge/"]<img src="images/badges/badge1.png" alt="badge symbol" height="75" width="25" />[/cb:if]

Please note your strings need to be REGEX safe. So if you have a quote or slash, etc.. they need to be escaped properly with back slash.

You should make your image paths absolute instead of relative though. Include the domain or use the live_site substitution below.

[cb:config param="live_site" /]


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: darranwil

Please Log in or Create an account to join the conversation.

  • darranwil
  • darranwil
  • OFFLINE
  • Posts: 28
  • Thanks: 1
  • Karma: 0
9 years 1 month ago #270128 by darranwil
Replied by darranwil on topic using multiple if statements not possible?
Thank you, worked perfectly. Now onto my newly again, original problem, lol..

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum