Cannot get cb:if substitution to display properly

2 years 9 months ago #325558 by boyjahq
We have a CB Field of type Custom HTML
Prepare content using CMS Content plugins = Yes

We are trying to render the text as a cb:if substitution result

This is the substitution:
[cb:if "[cb_membership_years]" > "0"]Member for [cb_membership_years] years[cb:else]First year member[/cb:else][/cb:if]

cb_membership_years is a CB Field of type Integer Number

But no matter what combination of things I try, this is how it renders on the profile page:

[cb:if "13" > "0"]Member for 13 years[cb:else]First year member[/cb:else][/cb:if]

Is there something missing in the syntax? Or is there some other reason that it is not rendering properly? We can see that the variables are rendering as they should.

Please Log in to join the conversation.

2 years 9 months ago #325560 by krileon
Your substitution is not valid syntax. Please read the substitution tutorial below carefully where the syntax is explained in detail with examples.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb


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.

Please Log in to join the conversation.

2 years 9 months ago - 2 years 9 months ago #325562 by boyjahq
I HAVE READ THAT DOCUMENT MORE TIMES THAN I HAVE LIVED YEARS ON THIS EARTH! I have tried EVERY POSSIBLE COMBINATION that I could find on that page. If I am required to find my syntax mistake by reading that page yet again, then I give up.

Can you at least point me to the exact place on the page that would give me a clue as to why this doesn't work?

I LITERALLY HAVE TRIED EVERY POSSIBLE COMBINATION OF THINGS ON THAT PAGE that I can think of. I have spent 5 full days doing that.

If you see the obvious syntax error, please tell me what it is. Please. PLEASE.

The substitution example I included in my post was probably the last of 500 different failed combinations that I tried, I just didn't have the patience to try to recreate them all to include in the post. Please understand, requesting assistance on this forum is the ABSOLUTELY POSITIVELY LAST RESORT. We will do anything and everything we can to solve issues like this on our own rather than post on the forum.

Please Log in to join the conversation.

2 years 9 months ago - 2 years 9 months ago #325566 by krileon
The syntax you're using is no where near what is documented. You've added quotes where no quotes are documented. You've added spaces where no spaces are documented. You're adding to the syntax which is not documented and expecting it to work. That's not going to work. The syntax is strict. You cannot deviate from it.

[cb:if "[cb_membership_years]" > "0"]CONTENT_HERE[/cb:if]

Assuming cb_membership_years is a field and it exists then you'd use the below as is documented in our tutorial.

[cb:if cb_membership_years>"0"]CONTENT_HERE[/cb:if]

Please read the tutorial more carefully. There are a dozen examples of how to use IF substitutions at the bottom. Looks like you may have had confusion regarding nested substitutions? Those are only strictly allowed in certain locations. Please read the "Nested Substitutions" section carefully regarding those.


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.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.202 seconds

Facebook Twitter LinkedIn