Totara Learn Open Discussions

Adding site logo in emails

 
John Unnever
Adding site logo in emails
by John Unnever - Wednesday, 23 May 2018, 7:43 AM
Group Partners

I noticed your new v11 and community websites include some html theme colors and that your community emails have included the site logo.  Can you share the code snippet you added to your theme page so that we can add our site logo in our email messages as well like you have done?

Sam Hemelryk
Re: Adding site logo in emails
by Sam Hemelryk - Wednesday, 23 May 2018, 2:54 PM
Group Totara
Hi John,


My post last month explains how to customise the email template, https://totara.community/mod/forum/discuss.php?d=22131

From there to get the image to work:

  1. Put the image into your themes pix directory.
    e.g. totara/theme/yourthemename/pix/site-logo.png
  2. Put the following snippet of code into the your email template where you want the image to appear.
    {{#pix}}site-logo, theme_yourthemename{{/pix}}


Cheers

Sam

John Unnever
Re: Adding site logo in emails
by John Unnever - Tuesday, 5 June 2018, 6:20 AM
Group Partners

Hi Sam,

Couple things.

1. Can mustache template files be overridden using the custom scripts directory?  Or do we have to create our own theme and make the changes to it there?

/theme/config.php

$THEME->doctype = 'html5';
$THEME->name = 'suave';
$THEME->parents = array('basis', 'roots', 'base');
$THEME->yuicssmodules = array();
$THEME->enable_dock = true;
$THEME->sheets = array('suave');  //I created a suave.css file and placed it in theme/suave/style .. doesn't seem to apply these changes though ?
$THEME->enable_dock = true;
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
$THEME->csspostprocess = 'theme_suave_process_css';
$THEME->parents_exclude_sheets = array(
    'roots' => array('totara', 'totara-rtl'),
    'base' => array('flexible-icons'),
)

I created a theme/pix directory and placed our logo.png file in there.  I then have the below code in the email mustache file:


<table width="100%" cellpadding="0" cellspacing="0" border="0">

    <tr>

        <td colspan="3" style="background-color: #97b9fc; line-height: 5px; font-size: 5px;">&nbsp;</td>

    </tr>

    <tr>

        <td width="10%">&nbsp;</td>

        <td valign="top">

            <br /><br />


            {{{body}}}


            <br />

        </td>

        <td width="10%">{{#pix}}logo, theme_suave{{/pix}}</td>

    </tr>

    <tr>

        <td colspan="3" style="background-color: #97b9fc; line-height: 5px; font-size: 5px;">&nbsp;</td>

    </tr>

    <tr>

        <td colspan="3" style="background-color: #3e60a8; line-height: 25px; font-size: 25px;">&nbsp;</td>

    </tr>

</table>


I am not seeing the logo in the emails, did i miss something?

Sam Hemelryk
Re: Adding site logo in emails
by Sam Hemelryk - Monday, 27 August 2018, 2:31 PM
Group Totara

Hi John,

I only just found your message sorry.

Did you get this working in the end, or is it still a problem?
The code you have there appears correct.
If it is still a problem are you able to share the markup that was actually received by email?

Kind regards
Sam