/** * _e * returns the content from the translation.json * Will requre a means to look-up the correct part of the translation file * * eg. from translation.json: * * "html_title" :{ <-- $section * "EN" : { <-- $domain * "title" : "This is the email title" <--$text ( in this case it's "title") * "link" : "http://somelink.com" <--$text ( in this case "link" ) * } * } * * @param string $text * @param string $section * @param string $domain * @return string */ public function _e($params) { global $mc_edm_config; $section = isset($this->section) ? $this->section : ''; $defaults = array('text' => '', 'section' => $section, 'domain' => $this->domain); extract(array_merge($defaults, $params)); $this->section = $section; $this->domain = $domain; $content = $this->data->{$section}->{$domain}->{$text}; if (!$content) { $domain = 'EN'; $content = $this->data->{$section}->{$domain}->{$text}; } // append google tracking modifiers if ($text === 'link' || $text === 'video' || $text === 'button') { $content .= _e_tracking($section); } return str_replace("\n", '<br />', $content); }
<!-- BEGIN BODY // --> <table <?php inline_style('content', 'table'); ?> > <tr> <td align="center" valign="top"> <?php echo $mc_edm->get_view('preheader'); ?> </td> </tr> <?php $bannerUrl = 'http://www.aussiebum.com/sale' . _e_tracking('banner'); _e_set_section('banner'); //summer clearance $center_table = array('class' => 'center_table', 'td' => array(array('image' => 'en_header1', 'link' => $bannerUrl))); echo table($center_table); //sale banner $center_table = array('class' => 'center_table', 'td' => array(array('image' => 'en_clearance', 'link' => $bannerUrl))); echo table($center_table); echo tr_spacer(); //unsure how to split into 2 columns $message_table = array('class' => 'center_table', 'td' => array(array('image' => 'spacer', 'width' => 100), array('font' => _e(array('text' => 'content', 'section' => 'message')), 'valign' => 'top'), array('image' => 'spacer', 'width' => 100))); echo table($message_table); echo tr_spacer(); //button $center_table = array('class' => 'center_table', 'td' => array(array('image' => 'en_show_now', 'link' => $bannerUrl))); echo table($center_table);
<table <?php inline_style('template_preheader', 'table'); ?> > <tr> <!-- *|IFNOT:ARCHIVE_PAGE|* --> <td <?php inline_style('template_preheader_content', 'table'); ?> > <center> <?php echo _e(array('text' => 'view_browser')); ?> <a href="*|ARCHIVE|*<?php echo _e_tracking('html_email'); ?> " target="_blank" <?php echo inline_style('template_preheader_link'); ?> > <?php echo _e(array('text' => 'view_browser_link')); ?> </a> <?php echo _e(array('text' => 'view_browser_end')); ?> </center> </td> <!-- *|END:IF|* --> </tr>
/** * [get_product_url] * Looks up up the product url from live site * @param int $id product Item id * @param string $tracking the string appended to to the product url * @return string */ function get_product_url($id, $tracking = '') { $mc_edm = MC_edm::get_instance(); $url = $mc_edm->get_product_url($id); $extra_params = array(); $item = $mc_edm->get_dynamic_price(array('id' => $id, 'currency' => 'au')); if (isset($item->price)) { $extra_params = array('price' => $item->price); } if ($tracking) { $tracking = _e_tracking($tracking, $extra_params); } return $url . $tracking; }