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 (Moderator: Dave Greenberg) »
  • Email template change
Pages: [1]

Author Topic: Email template change  (Read 1477 times)

pjindent

  • I post occasionally
  • **
  • Posts: 34
  • Karma: 2
Email template change
August 05, 2010, 12:28:33 pm
I have made a change to the event template and now registration emails have stopped.  This is the code I have modified ... see the preg_replace() function.  Where is the error log where I can check error in my code?
Please suggest what is wrong with my function.  I have tested the function in a php editor and it works.


      {if $amount && !$lineItem}
       {foreach from=$amount item=amnt key=level}
        <tr>
         <td colspan="2" {$valueStyle}>
          {$amnt.amount|crmMoney} <br>  {preg_replace('/(- \d+)/',"$1<br>",'{$amnt.label}')}
         </td>
        </tr>
       {/foreach}
      {/if}

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Email template change
August 05, 2010, 01:23:50 pm

please check the smarty manual

http://www.smarty.net/manual/en/language.function.php.php

u need to let smarty know that its a php string etc.

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

pjindent

  • I post occasionally
  • **
  • Posts: 34
  • Karma: 2
Re: Email template change
August 05, 2010, 02:16:36 pm
Quote from: Donald Lobo on August 05, 2010, 01:23:50 pm

please check the smarty manual

http://www.smarty.net/manual/en/language.function.php.php

u need to let smarty know that its a php string etc.

lobo


Should it be?  Just wondering how variables are passed to php.  
{php}
echo preg_replace('/(\d+)/','$1<br>',$amnt.label);
{/php}
This does not work, the smarty variable is not being passed to php.
« Last Edit: August 05, 2010, 09:02:29 pm by pjindent »

pjindent

  • I post occasionally
  • **
  • Posts: 34
  • Karma: 2
Re: Email template change
August 05, 2010, 09:01:26 pm
Did not need php.  Used smarty function regex_replace:

          {$amnt.label|regex_replace:"/(- \d+)/":"\\1<br>"}

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Email template change

This forum was archived on 2017-11-26.