[SOLVED] CB If / and / Includes Statement Help

11 years 6 months ago - 11 years 6 months ago #212825 by marriage_minded_man
[SOLVED] CB If / and / Includes Statement Help was created by marriage_minded_man
I looked at the substitution tutorial and still having difficulty with this.

My users fill in a field (named cb_websiteurl) with the URL of their website. I use a delimiter field to display an Ifram of their site only if they have that field filled in.

Some of them put the "http" and some of them want to punish me for sins of a past life and do not put the "http".

I would like to put an if statement that says the following:

[cb:if cb_websiteurl!="" and includes "http://"]<iframe name="websiteurl" height="500" width="962" scrolling="auto" src="[cb_websiteurl]">
<p>Your browser does not support iframes.</p>
</iframe>[/cb:if]


and alternatively

[cb:if cb_websiteurl!="" and !includes "http://"]<iframe name="websiteurl" height="500" width="962" scrolling="auto" src="http://[cb_websiteurl]">
<p>Your browser does not support iframes.</p>
</iframe>[/cb:if]


Am I making sense? However the if statements I put together arent working for me. I also tried using [cb:if cb_websiteurl="http://*"] as if to use the * as a wildcard, but that didn't work either.

What am I doing wrong?

Please Log in to join the conversation.

11 years 6 months ago #212893 by krileon
Replied by krileon on topic Re: CB If / and / Includes Statement Help
Please see Tutorials within my signature for further substitution usage information as a substitution tutorial is already provided; your syntax is completely off. Tutorial explains how to use the substitutions as well as multiple examples at the bottom of the tutorial.

As for the includes there is a known bug resulting in them not working correctly (note your syntax for their usage is still incorrect). Please see below bug ticket regarding this.

forge.joomlapolis.com/issues/3739


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.

11 years 6 months ago - 11 years 6 months ago #212983 by marriage_minded_man
Replied by marriage_minded_man on topic Re: CB If / and / Includes Statement Help
I'm sorry Krileon. I've read the turorial and still cant get includes to work. It only seems to work if the value is exact, the same as = (equal to).

With cb_websiteurl filled in with
http://www.website.com/
, I test the following:
[cb:if cb_websiteurl="http://www.website.com/"]Displays fine[/cb:if]

[cb:if cb_websiteurl includes "http://www.website.com/"]Displays fine[/cb:if]

[cb:if cb_websiteurl includes "http"]Does not display.[/cb:if]

By the way, I have also applied the patch you mentioned but in my file it was on line 1644 not 1654.

Please Log in to join the conversation.

11 years 6 months ago #213047 by krileon
Replied by krileon on topic Re: CB If / and / Includes Statement Help
It does not work on website fields. It only works on fields that'd have an array, which is dropdown multiselect, multicheckbox, gids, etc..

By the way, I have also applied the patch you mentioned but in my file it was on line 1644 not 1654.

That's fine as I'm on SVN (developer build of CB) so lines may not match 100%.


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.

11 years 6 months ago #213049 by marriage_minded_man
Replied by marriage_minded_man on topic Re: CB If / and / Includes Statement Help
Then how can i put together an IF statement that says if a text field includes "http" then display? Is there no way to ask if there is a specific string of text within a text input website field?

Please Log in to join the conversation.

11 years 6 months ago #213058 by krileon
Replied by krileon on topic Re: CB If / and / Includes Statement Help
You'll need to use REGEX. Example as follows.

[cb:if cb_websiteurl=~"/^http/i"]Begins with HTTP[/cb:if]


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.250 seconds

Facebook Twitter LinkedIn