Please read and follow the COMMON ISSUES first!
Always add your version information in every new post! Thank you!

Form2Content Forum

Questions and answers for Form2Content, a Joomla CCK.
  1. Hans de Jong
  2. F2C article templating
  3. Tuesday, 11 December 2018
  4.  Subscribe via email
I entered the following line in an article template

{if contains( $FIRST_NAME_RAW,'&' ) or contains( $FIRST_NAME_RAW,'+' ) or contains( $FIRST_NAME_RAW,',' )}

When I try to save a F2C article I get the error message

Syntax Error in template "/home/teenki1q/public_html/media/com_form2content/templates/custom_main_template_model public profiles.tpl" on line 29 "{if contains( $FIRST_NAME_RAW,'&' ) or contains( $FIRST_NAME_RAW,'+' ) or contains( $FIRST_NAME_RAW,',' )}" unknown function "contains"

I guess I am doing something wrong...
Accepted Answer
Accepted Answer Pending Moderation
I finally managed to get it working by using the strstr modifier:

{if $FIRST_NAME_RAW|strstr:"&" or $FIRST_NAME_RAW|strstr:"+" or $FIRST_NAME_RAW|strstr:","}
Responses (3)
Accepted Answer Pending Moderation
Have you tried this syntax?
https://documentation.form2content.com/documentation/f2c-smarty-code-snippets/44-checking-a-field-for-a-value-if-contains

Another way might be:
https://whmcs.community/topic/273561-smarty-conditionals-does-not-contain/

Regards,
Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so ;)
  1. more than a month ago
  2. F2C article templating
  3. # 1
Accepted Answer Pending Moderation
Hi Hans,

Thanks for sharing your solution!

Regards, Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so ;)
  1. more than a month ago
  2. F2C article templating
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.