Example #1
0
 /**
  * @param bool $bAdmin = false
  * @param bool $bJsOutput = true
  *
  * @return string
  */
 public function compileTemplates($bAdmin = false, $bJsOutput = true)
 {
     $sHtml = \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH . 'app/templates/Views/Components', $this->oActions, 'Component') . \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH . 'app/templates/Views/' . ($bAdmin ? 'Admin' : 'User'), $this->oActions) . \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH . 'app/templates/Views/Common', $this->oActions) . $this->oActions->Plugins()->CompileTemplate($bAdmin);
     return $bJsOutput ? 'window.rainloopTEMPLATES=' . \MailSo\Base\Utils::Php2js(array($sHtml), $this->Logger()) . ';' : $sHtml;
 }
 /**
  * @param bool $bAdmin = false
  * @param bool $bJsOutput = true
  *
  * @return string
  */
 public function compileTemplates($bAdmin = false, $bJsOutput = true)
 {
     $aTemplates = array();
     \RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH . 'app/templates/Views/Components', 'Component');
     \RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH . 'app/templates/Views/' . ($bAdmin ? 'Admin' : 'User'));
     \RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH . 'app/templates/Views/Common');
     $this->oActions->Plugins()->CompileTemplate($aTemplates, $bAdmin);
     $sHtml = '';
     foreach ($aTemplates as $sName => $sFile) {
         $sName = \preg_replace('/[^a-zA-Z0-9]/', '', $sName);
         $sHtml .= '<script id="' . $sName . '" type="text/html" data-cfasync="false">' . $this->oActions->ProcessTemplate($sName, \file_get_contents($sFile)) . '</script>';
     }
     unset($aTemplates);
     return $bJsOutput ? 'window.rainloopTEMPLATES=' . \MailSo\Base\Utils::Php2js(array($sHtml), $this->Logger()) . ';' : $sHtml;
 }
 /**
  * @param bool $bAdmin = false
  *
  * @return string
  */
 private function compileTemplates($bAdmin = false)
 {
     $sHtml = \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH . 'app/templates/Views/' . ($bAdmin ? 'Admin' : 'App'), $this->oActions) . \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH . 'app/templates/Views/Common', $this->oActions) . $this->oActions->Plugins()->CompileTemplate($bAdmin);
     return 'window.rainloopTEMPLATES=' . \MailSo\Base\Utils::Php2js(array($sHtml), $this->Logger()) . ';';
 }