CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Smarty in mail errors with spaces in variables
Pages: [1]

Author Topic: Smarty in mail errors with spaces in variables  (Read 540 times)

questions

  • I post occasionally
  • **
  • Posts: 79
  • Karma: 2
  • CiviCRM version: 4.4.6
  • CMS version: Durpal, 7
  • MySQL version: 5.1
  • PHP version: 5.3
Smarty in mail errors with spaces in variables
September 15, 2012, 01:52:56 pm
I have a email template that I send out to get people to verify their info every year.  It has some smarty if then type things.  It worked no problem last year.  We upgraded to 3.4.7 since then and now it doesn't work.  Well, it still works with plain text but not HTML.

Because households don't have a firstname I do a

{if "{contact.last_name}" neq ""}
First Name:   {contact.first_name}
Last Name:    {contact.last_name}
{/if}

This blew up.  After considerable trial and mostly error I discovered it didn't like the quotes.  So I went to assigning last_name and null to variable

{assign var=LastName value="{contact.last_name}"}
{assign var=Empty value=null}
{if $LastName neq $Empty}

This worked until it hit a last name that had a space in it like Van Buren, then it complains of     

syntax error: expecting '=' after attribute name 'Van'

Anyone have any thoughts on how to either fix this or get around it?

questions

  • I post occasionally
  • **
  • Posts: 79
  • Karma: 2
  • CiviCRM version: 4.4.6
  • CMS version: Durpal, 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Smarty in mail errors with spaces in variables
September 15, 2012, 10:05:18 pm
Found the problem.  After much messing with stuff, something I saw in a google search made me wonder about the wysiwyg editor and maybe it was messing up what I entered.  I had looked at the source but hadn't seen anything really wrong.  I was using CKeditor.  Switching to TinyMCE made the smarty stuff work.  I'm not sure this documented anywhere in the stuff about smarty. 

I had switched to CKeditor because TinyMCE doesn't work all that well, at least with Firefox, maybe with something else.  For example, I can't get it show me the HTML.  So, sigh, I guess it's switch back and forth depending on the task.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Smarty in mail errors with spaces in variables

This forum was archived on 2017-11-26.