当前位置: 首页>>代码示例>>PHP>>正文


PHP Mustache_Engine::render方法代码示例

本文整理汇总了PHP中Mustache_Engine::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Mustache_Engine::render方法的具体用法?PHP Mustache_Engine::render怎么用?PHP Mustache_Engine::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mustache_Engine的用法示例。


在下文中一共展示了Mustache_Engine::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderFile

 public function renderFile($templateNames, $data)
 {
     $this->ensureLoaded();
     $templatePath = null;
     foreach ($templateNames as $templateName) {
         echo $this->mustache->render($templateName, $data);
     }
 }
开发者ID:giftnuss,项目名称:PieCrust,代码行数:8,代码来源:MustacheTemplateEngine.php

示例2: render

 /**
  * Render a template
  *
  * @param   string  $source   The template path or content
  * @param   array   $data     An associative array of data to be extracted in local template scope
  * @throws \RuntimeException If the template could not be loaded
  * @return string The rendered template
  */
 public function render($source, array $data = array())
 {
     parent::render($source, $data);
     //Let mustache load the template by proxiing through the load() method.
     $result = $this->_mustache->render($source, $data);
     //Render the debug information
     return $this->renderDebug($result);
 }
开发者ID:nooku,项目名称:nooku-framework,代码行数:16,代码来源:mustache.php

示例3: renderTemplate

 /**
  * @param $_pageContent : Contenu à "templater"
  * @param null $_data : Source de données optionnelle
  */
 function renderTemplate($_pageContent, $_data = null)
 {
     // Ajout des constantes de chemin absolu
     $_data["PUBLIC_ABSOLUTE_PATH"] = PUBLIC_ABSOLUTE_PATH;
     $_data["SERVER_ABSOLUTE_PATH"] = SERVER_ABSOLUTE_PATH;
     $mustache = new Mustache_Engine();
     // Favicons
     $_data["favicons"] = $mustache->render(file_get_contents("public/html/favicons.html"), $_data);
     echo $mustache->render($_pageContent, $_data);
 }
开发者ID:Swapon444,项目名称:Patrimoine,代码行数:14,代码来源:controller.php

示例4: render

 /**
  * {@inheritdoc}
  *
  * @param string  $path
  * @param array   $params
  * @param boolean $mustClean
  */
 public function render($path, $params, $mustClean = false)
 {
     if (!isset($params['content'])) {
         $params['content'] = $this->_view->getContent();
     }
     $content = $this->mustache->render(file_get_contents($path), $params);
     if ($mustClean) {
         $this->_view->setContent($content);
     } else {
         echo $content;
     }
 }
开发者ID:nineeshk,项目名称:incubator,代码行数:19,代码来源:Mustache.php

示例5: render

 /**
  * {@inheritdoc}
  *
  * @param string  $path
  * @param array   $params
  * @param boolean $mustClean
  */
 public function render($path, $params, $mustClean = false)
 {
     if (!isset($params['content'])) {
         $params['content'] = $this->_view->getContent();
     }
     $tplContent = $this->getCachedTemplate($path);
     $content = $this->mustache->render("{{%FILTERS}}\n" . $tplContent, $params);
     if ($mustClean) {
         $this->_view->setContent($content);
     } else {
         echo $content;
     }
 }
开发者ID:kathynka,项目名称:Foundation,代码行数:20,代码来源:Mustache.php

示例6: render

 public function render()
 {
     $m = new \Mustache_Engine();
     $template = $this->template->contents();
     $output = $m->render($template, $this->context);
     $this->output->write($output);
 }
开发者ID:bahulneel,项目名称:php-templatr,代码行数:7,代码来源:Templatr.php

示例7: render

 /**
  * Render the output for this module (out.ctp).
  *
  * @param BasicThemeView $view
  * @return string
  */
 public function render($view)
 {
     if (method_exists($this, 'beforeRender')) {
         $this->beforeRender();
     }
     if (method_exists($this, 'getContext')) {
         $contextClass = $this->getContext();
         $context = new $contextClass($view, $this->data);
         $template = $this->path() . DS . 'out.mustache';
     } else {
         $template = $this->path() . DS . 'out.ctp';
     }
     if (!file_exists($template)) {
         user_error(__d('wasabi_cms', 'Template "{0}" for module {1} not found.', $template, $this->name()));
     }
     if (isset($context)) {
         if (!$this->_mustache) {
             $this->_mustache = new \Mustache_Engine();
         }
         $output = $this->_mustache->render(file_get_contents($template), $context);
     } else {
         $output = $view->element('Wasabi/Cms.module', ['template' => $template, 'data' => $this->data]);
     }
     return $output;
 }
开发者ID:wasabi-cms,项目名称:cms,代码行数:31,代码来源:Module.php

示例8: render

 public function render($template, $data=true)
 {   
     $data=$this->createView($data);
     return $this->m->render("{{# render}}$template{{/ render}}",[
         'session'=>[
             'debug'=>DEBUG,
             'hc'=> 
                 $this->api->estAuthentifier()?
                 $this->api->compteConnecte()->contraste:
                 false,
             'pages'=>$this->api->API_pages_lister(),
             'compte'=>$this->api->compteConnecte(),
             'estAuthentifier'=>$this->api->estAuthentifier(),
             'estAdministrateur'=>$this->api->estAdmin(),
             'estDesactive'=>$this->api->estDésactivé(),
             'estLibreService'=>$this->api->estLibreService(),
             'estNouveau'=>$this->api->estNouveau(),
             //'estPanier'=>$this->api->estPanier(),
             //'estPremium'=>$this->api->estPremium(),
             'peutCommander'=>$this->api->peutCommander(),
             'peutModifierCommande'=>function($value){
                 return $this->api->peutModifierCommande($value);
             }
         ],
         'data'=>$data
     ]);
     
 }
开发者ID:RomLAURENT,项目名称:Jar2Fer,代码行数:28,代码来源:layout.php

示例9: show_news

 public static function show_news($folder = 'posts', $template = 'templates')
 {
     $m = new Mustache_Engine();
     $files = glob("{$folder}/*.md");
     /** /
         usort($files, function($a, $b) {
             return filemtime($a) < filemtime($b);
         });
         /**/
     $html = '';
     foreach ($files as $file) {
         $route = substr($file, strlen($folder) + 1, -3);
         $page = new FrontMatter($file);
         $title = $page->fetch('title') != '' ? $page->fetch('title') : $route;
         $date = $page->fetch('date');
         $author = $page->fetch('author');
         $description = $page->fetch('description') == '' ? '' : $page->fetch('description');
         $data[] = array('title' => $title, 'route' => $route, 'author' => $author, 'description' => $description, 'date' => $date);
     }
     /**/
     function date_compare($a, $b)
     {
         $t1 = strtotime($a['date']);
         $t2 = strtotime($b['date']);
         return $t1 - $t2;
     }
     usort($data, 'date_compare');
     $data = array_reverse($data);
     /**/
     $template = file_get_contents('templates/show_news.tpl');
     $data['files'] = $data;
     return $m->render($template, $data);
     return $html;
 }
开发者ID:modularr,项目名称:markpresslib,代码行数:34,代码来源:MarkPressLib.php

示例10: render

 /**
  * Renders a template using Mustache.php.
  *
  * @see View::render()
  * @param string $template The template name specified in Slim::render()
  * @return string
  */
 public function render($template)
 {
     require_once self::$mustacheDirectory . '/Autoloader.php';
     \Mustache_Autoloader::register(dirname(self::$mustacheDirectory));
     $m = new \Mustache_Engine();
     $contents = file_get_contents($this->getTemplatesDirectory() . '/' . ltrim($template, '/'));
     return $m->render($contents, $this->data);
 }
开发者ID:Alexander173,项目名称:angular-noCaptcha-reCaptcha,代码行数:15,代码来源:Mustache.php

示例11: generate

 /**
  * Generate the objects and factories
  */
 public function generate()
 {
     $this->readyDestinationDirectory();
     $tableSchemas = (new SchemaGenerator($this->connection))->getTableSchemas();
     // @codeCoverageIgnoreStart
     if ($tableSchemas === null || count($tableSchemas) === 0) {
         throw new \Parm\Exception\ErrorException("No tables in database.");
     }
     // @codeCoverageIgnoreEnd
     $globalNamespaceData['tables'] = [];
     $globalNamespaceData['namespace'] = $this->generateToNamespace;
     $globalNamespaceData['escapedNamespace'] = $this->generateToNamespace != "" ? str_replace("\\", "\\\\", $this->generateToNamespace) . "\\\\" : '';
     $globalNamespaceData['namespaceLength'] = strlen($this->generateToNamespace) + 1;
     foreach ((new SchemaGenerator($this->connection))->getTableSchemas() as $tableName => $schema) {
         $globalNamespaceData['tables'][] = ['className' => ucfirst(\Parm\Row::columnToCamelCase($tableName))];
         $data = $this->getTemplatingDataFromSchema($schema);
         $m = new \Mustache_Engine();
         $this->writeContentsToFile(rtrim($this->destinationDirectory, '/') . '/' . $data['className'] . 'Table.php', $m->render(file_get_contents(dirname(__FILE__) . '/templates/table_interface.mustache'), $data));
         $this->writeContentsToFile(rtrim($this->destinationDirectory, '/') . '/' . $data['className'] . 'TableFunctions.php', $m->render(file_get_contents(dirname(__FILE__) . '/templates/table_trait.mustache'), $data));
         $this->writeContentsToFile(rtrim($this->destinationDirectory, '/') . '/' . $data['className'] . 'DaoObject.php', $m->render(file_get_contents(dirname(__FILE__) . '/templates/dao_object.mustache'), $data));
         $this->writeContentsToFile(rtrim($this->destinationDirectory, '/') . '/' . $data['className'] . 'DaoFactory.php', $m->render(file_get_contents(dirname(__FILE__) . '/templates/dao_factory.mustache'), $data));
         // global namespace file
         if ($this->generateToNamespace != "\\" && $this->generateToNamespace != "") {
             $this->writeContentsToFile(rtrim($this->destinationDirectory, '/') . '/alias_all_tables_to_global_namespace.php', $m->render(file_get_contents(dirname(__FILE__) . '/templates/alias_all_tables_to_global_namespace.mustache'), $globalNamespaceData));
             $this->writeContentsToFile(rtrim($this->destinationDirectory, '/') . '/autoload.php', $m->render(file_get_contents(dirname(__FILE__) . '/templates/namespaced_autoload.mustache'), $globalNamespaceData));
         } else {
             $this->writeContentsToFile(rtrim($this->destinationDirectory, '/') . '/autoload.php', $m->render(file_get_contents(dirname(__FILE__) . '/templates/global_autoload.mustache'), $globalNamespaceData));
         }
     }
 }
开发者ID:AlexValGal,项目名称:Practica-FInal-DIW-DWC,代码行数:33,代码来源:Generator.php

示例12: mustacheRender

 public static function mustacheRender($template, $values)
 {
     TemplateEngine::getMustacheInstance();
     $m = new Mustache_Engine();
     //
     $response = $m->render($template, $values);
     //        $response = preg_replace('/[\s\t\n\r\s]+/', ' ', $response);
     return $response;
 }
开发者ID:alex2stf,项目名称:phpquick,代码行数:9,代码来源:TemplateEngine.php

示例13: render

 public function render($filename, $tplvars = false, $nodisplay = false)
 {
     $data = $this->mergeData($tplvars);
     $tpl = parent::render($filename, $data);
     if ($nodisplay) {
         return $tpl;
     } else {
         echo $tpl;
     }
 }
开发者ID:adamhesim,项目名称:karet,代码行数:10,代码来源:MustView.php

示例14: register

 function register()
 {
     if ('POST' == $_SERVER['REQUEST_METHOD']) {
         //stocke les valeurs
         $email = strtolower($_POST["txtMail"]);
         $firstName = $_POST["txtFirstName"];
         $lastName = $_POST["txtLastName"];
         $phone = $_POST["txtPhone"];
         $pass = $_POST["txtPassword"];
         $passCheck = $_POST["txtPasswordConfirm"];
         if (!empty($_POST["txtMail"]) and !empty($_POST["txtFirstName"]) and !empty($_POST["txtLastName"]) and !empty($_POST["txtPhone"]) and !empty($_POST["txtPassword"])) {
             //modifier le numéro de téléphone afin de correspondre à la BD
             $phone = self::normalizePhoneNumber($phone);
             //vérifier si informations valides (email + pass)
             if (Users::getUserIdByName($email) == -1 && $pass == $passCheck) {
                 $salt = self::generateSalt();
                 $crypt = crypt($pass, $salt);
                 $userId = Users::addFamilyOwner($email, $phone, $firstName, $lastName, $crypt, $salt);
                 $owner = $userId;
                 $name = "Contenant principal";
                 $parent = null;
                 $value = 0;
                 $initValue = 0;
                 $warranty = "";
                 $infos = "";
                 $summary = "Contenant de départ";
                 $public = 1;
                 $quantity = 1;
                 Objects::addObject($name, $owner, $parent, $value, $initValue, $warranty, $infos, $summary, $public, $quantity);
                 header(CONNECTION_HEADER . '/registration');
                 if (isset($userId)) {
                     $user = Users::getUser($userId);
                     $headers = 'MIME-Version: 1.0' . "\r\n";
                     $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
                     $to = "";
                     $recipients = Users::getAllAdminMail();
                     foreach ($recipients as $recipient) {
                         $to .= $recipient . ', ';
                     }
                     substr($to, 0, -2);
                     $subject = "Nouvelle demande de patrimoine";
                     $data = array('path' => SERVER_ABSOLUTE_PATH . "/sysadmin", 'user' => $user["UserName"], 'img' => PUBLIC_ABSOLUTE_PATH . "/assets/logo_petit.png");
                     $mustache = new Mustache_Engine();
                     mail($to, $subject, $mustache->render(file_get_contents('public/html/mailtemplateregistration.html'), $data), $headers . "From: " . SENDING_EMAIL);
                 }
             } else {
                 $data = array("SERVER_ABSOLUTE_PATH" => SERVER_ABSOLUTE_PATH, "PUBLIC_ABSOLUTE_PATH" => PUBLIC_ABSOLUTE_PATH, "Error" => true, "ErrorMSG" => Users::getUserIdByName($email) != -1 ? "Adresse courriel déjà en utilisation" : "Vous devez saisir le même mot de passe", "FirstName" => $firstName, "LastName" => $lastName, "Phone" => $phone, "Email" => $email);
                 $this->renderTemplate(file_get_contents(REGISTRATION_PAGE), $data);
             }
         } else {
             $data = array("SERVER_ABSOLUTE_PATH" => SERVER_ABSOLUTE_PATH, "PUBLIC_ABSOLUTE_PATH" => PUBLIC_ABSOLUTE_PATH, "Error" => true, "ErrorMSG" => "Informations manquantes", "FirstName" => $firstName, "LastName" => $lastName, "Phone" => $phone, "Email" => $email);
             $this->renderTemplate(file_get_contents(REGISTRATION_PAGE), $data);
         }
     }
 }
开发者ID:Swapon444,项目名称:Patrimoine,代码行数:55,代码来源:registration.php

示例15: render

 static function render($view, $data)
 {
     global $aplication;
     global $debugbar;
     $app = $aplication->getApp();
     $path = $app->getViews();
     Mustache_Autoloader::register();
     $options = array('extension' => '.mustache');
     $template = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader($path, $options)));
     echo $template->render($view, $data);
 }
开发者ID:elephantphp,项目名称:ElephantFreamwork,代码行数:11,代码来源:View.php


注:本文中的Mustache_Engine::render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。