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) »
  • Using {config_load} in email templates
Pages: [1]

Author Topic: Using {config_load} in email templates  (Read 510 times)

gmarsh

  • I’m new here
  • *
  • Posts: 17
  • Karma: 0
  • CiviCRM version: 4.4.2
  • CMS version: Joomla 2.5.14
  • MySQL version: 5.5.32
  • PHP version: 5.3.26
Using {config_load} in email templates
August 13, 2012, 07:00:00 am
I would like to use the Smarty {config_load} command to load colors as variables in all email templates so that the resulting emails will match the site template.  But I have been unable to get a config file to load.  I've used both an absolute URL for the file and a file path (as shown below) and neither works.  I've checked the Smarty package in Civi and have verified that the plugin [function.config_load.php] is present, but it may be looking for the config file in a particular location that I haven't been able to determine.

I know the {capture} function works.  If I replace the loaded variable "#headerBgColor#" in the capture string with "#0073AE" the resulting style processes correctly.  I'm u

My test config file contents are:
     
Code: [Select]
#email templates configuration file
    # email parameters
       siteName = "Rescue Wild Animals"
       headerBgColor = #0073AE

And the test email template is:
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title></title>
</head>
<body>

{config_load file="/www/www/thr/civicrm_code/thrivent.conf"}

{capture name='header' assign='headerStyle'}style="text-align:left; width:600px;height: 210px; padding: 4px; background-color: {#headerBgColor#};margin: 0 auto;"{/capture}
{capture name='label' assign='labelStyle'}style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
{capture name='value' assign='valueStyle'}style="padding: 4px; border-bottom: 1px solid #999;"{/capture}


<center>
<table id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: center; font-size: 12px; width: 600px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td {$headerStyle}>
      <p>content of header</p>
</td>
</tr>
<tr>
<td>
<h1>{#siteName#}</h1>
</td>
</tr>
<tr>
<td style="padding-left: 50px; padding-right: 50px; padding-top: 20px; padding-bottom: 20px;"><!--{if $formValues.receipt_text_signup}
<p>{$formValues.receipt_text_signup|htmlize}</p>
{elseif $formValues.receipt_text_renewal}
<p>{$formValues.receipt_text_renewal|htmlize}</p>
{else}-->
<p>{ts}Thank you {contact.first_name}, for your participation in Thrivent Communities.{/ts}</p>
<!--{/if}     {if ! $cancelled}
<p>{ts}Please print this receipt for your records.{/ts}</p>
{/if}--></td>
</tr>
<tr>
<td style="font-size: 11px; margin-top: -10px; text-align: center; padding-bottom: 15px;"></td>
</tr>
</tbody>
</table>
</center>
</body>
</html

Any help along this line would be greatly appreciated!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Using {config_load} in email templates

This forum was archived on 2017-11-26.