Exemple #1
0
 /**
  * Render the view script and output it to string. Less
  * effecient than ::render - use only when required
  * 
  * @param string $path Path for the script to render
  * @param array $params Array with parameters to pass
  * @return string String containing the result
  */
 public static function renderToString($path, $params = null)
 {
     debug(__METHOD__ . "({$path}, {$params})");
     $view = new ViewRenderer($path);
     if ($params) {
         $view->assign($params);
     }
     return $view->doRenderToString();
 }
Exemple #2
0
 public static function render($script, $params = null, $contact = null)
 {
     $layout = new ViewRenderer(APP_PATH . '/layouts/mail.php');
     $body = new ViewRenderer($script);
     $body->assign($params);
     if ($contact !== null) {
         // Commented out to remove the opt-out link while it's broken
         // $layout->optoutUrl = self::buildAuthenticationUrl('optout', $contact);
         $body->contact = $contact;
     }
     $layout->body = $body;
     return $layout->doRenderToString();
 }