• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP TemplateEngine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testRenderWithAbsoluteTemplatePath

 public function testRenderWithAbsoluteTemplatePath()
 {
     $engine = new TemplateEngine(__DIR__ . '/../fixtures/templates');
     $result = $engine->render(__DIR__ . '/../fixtures/templates/1.php', array('message' => 'World'));
     $this->assertNotEmpty($result);
     //$this->assertEquals("<h1>Hello World</h1>\n", $result);
 }
开发者ID:PierreCharles,项目名称:uFramework-PHP,代码行数:7,代码来源:TemplateEngineTest.php


示例2: sendSystemEmailFromTemplate

 /**
  * Sends an e-mail (text format) from the system to the specified recipient. 
  * Difference to sendSystemEmail(): Content is extracted from a template file.
  * 
  * @param WebSoccer $websoccer current context.
  * @param I18n $i18n messages context
  * @param string $recipient recipient e-mail address
  * @param string $subject Already translated e-mail subject.
  * @param string $templateName name of template (NOT template file name, i.e. WITHOUT file extension!) to use for the e-mail body.
  * @param array $parameters array of parameters to use in the template (key=parameter name, value= parameter value).
  */
 public static function sendSystemEmailFromTemplate(WebSoccer $websoccer, I18n $i18n, $recipient, $subject, $templateName, $parameters)
 {
     $emailTemplateEngine = new TemplateEngine($websoccer, $i18n, null);
     $template = $emailTemplateEngine->loadTemplate('emails/' . $templateName);
     $content = $template->render($parameters);
     self::sendSystemEmail($websoccer, $recipient, $subject, $content);
 }
开发者ID:astroChasqui,项目名称:open-websoccer,代码行数:18,代码来源:EmailHelper.class.php


示例3: actionView

 public function actionView($id)
 {
     $articleModel = new ArticleModel();
     $article = $articleModel->get($id);
     if ($article === false) {
         throw new Http404();
     }
     $templateEngine = new TemplateEngine();
     return $templateEngine->render('articles/view.html', $article);
 }
开发者ID:rrgraute,项目名称:php_mvc-ws-cli-memdb,代码行数:10,代码来源:ArticlesController.php


示例4: render

 function render()
 {
     $template = new TemplateEngine($this->filepath);
     $template->set($this->templateData);
     $template->setGlobals($this->templateGlobals);
     $template->display();
     if (isset($_GET['DEBUG'])) {
         echo '<pre>';
         var_dump($this->templateData);
         echo '</pre>';
     }
 }
开发者ID:BikeMaker,项目名称:Code,代码行数:12,代码来源:WebModule.php


示例5: getInstance

 private static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new TemplateEngine();
     }
     return self::$instance;
 }
开发者ID:ekowabaka,项目名称:wyf,代码行数:7,代码来源:TemplateEngine.php


示例6: beforeRender

 public function beforeRender()
 {
     $menuSource = "";
     foreach ($this->menuEntries as $name => $link) {
         $menuSource .= '<li><a href="' . $link . '">' . $name . '</a></li>';
     }
     TemplateEngine::getInstance()->replaceMarks("menu", $menuSource);
 }
开发者ID:hendrikstill,项目名称:manusing,代码行数:8,代码来源:Menu.php


示例7: renderTable

 public function renderTable(TableContent $content)
 {
     $templates = array('widths' => $content->getTableWidths(), 'as_totals_box' => $content->getAsTotalsBox(), 'num_columns' => $content->getNumColumns(), 'data' => $content->getData(), 'headers' => $content->getHeaders(), 'auto_totals' => $content->getAutoTotals(), 'types' => $content->getDataTypes());
     if ($templates['auto_totals']) {
         $templates['totals'] = $content->getTotals();
     }
     $this->markup .= TemplateEngine::render(__DIR__ . '/html_templates/table.tpl', $templates);
 }
开发者ID:ekowabaka,项目名称:wyf,代码行数:8,代码来源:HtmlRenderer.php


示例8: __construct

 private function __construct()
 {
     $this->classloader = Classloader::getInstance();
     $this->classloader->initLoadLib();
     $this->dataConnector = DataConnector::getInstance();
     $this->routingEngine = RoutingEngine::getInstance();
     $this->templateEngine = TemplateEngine::getInstance();
 }
开发者ID:hendrikstill,项目名称:manusing,代码行数:8,代码来源:Manusing.php


示例9: init

 /**
  * @see	wcf\system\template\TemplateEngine::__construct()
  */
 protected function init()
 {
     parent::init();
     $this->templatePaths = array(1 => WCF_DIR . 'acp/templates/');
     $this->compileDir = WCF_DIR . 'acp/templates/compiled/';
     if (!defined('NO_IMPORTS')) {
         $this->loadTemplateListeners();
     }
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:12,代码来源:ACPTemplateEngine.class.php


示例10: renderTree

 /**
  * renders tree into menu template
  * @return  object
  */
 public function renderTree()
 {
     if (!$this->getConfig()->template_menu) {
         return;
     }
     if (!$this->tree) {
         return;
     }
     $template = new TemplateEngine($this->templatePath . $this->getConfig()->template_menu);
     $template->setCacheable(true);
     $cache = Cache::getInstance();
     if (!$cache->isCached('submenu')) {
         $childs = array();
         $childlist = $this->tree->getChildList($this->tree->getCurrentId());
         foreach ($childlist as $item) {
             if (isset($item['visible']) && !$item['visible']) {
                 continue;
             }
             $item['path'] = $this->tree->getPath($item['id']);
             $childs[] = $item;
         }
         $template->setVariable('submenu', $childs, false);
         $cache->save(serialize($childs), 'submenu');
     } else {
         $template->setVariable('submenu', unserialize($cache->getCache('submenu')), false);
     }
     // check if template is in cache
     if ($template->isCached()) {
         return $template;
     }
     $menu = $this->tree->getRootList();
     // get selected main menu item
     $firstNode = $this->tree->getFirstAncestorNode($this->tree->getCurrentId());
     $firstId = $firstNode ? $firstNode['id'] : 0;
     foreach ($menu as &$item) {
         $item['path'] = isset($item['external']) && $item['external'] ? $item['url'] : $this->tree->getPath($item['id']);
         $item['selected'] = $item['id'] == $firstId;
     }
     $template->setVariable('menu', $menu, false);
     $auth = Authentication::getInstance();
     $template->setVariable('loginName', $auth->getUserName(), false);
     return $template;
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:47,代码来源:AdminTheme.php


示例11: render

 /**
  * Render informer html-code reserved for page URL
  * Use cache
  *
  * @param $url
  * @return string
  */
 public function render($url)
 {
     $data = $this->getData($url);
     if (!empty($data['informer_id'])) {
         $engine = new TemplateEngine();
         $cacheKey = 'compiled_' . $data['informer_id'];
         $compiled = $this->cache->get($cacheKey);
         if (!$compiled) {
             $template = $this->getTemplate($data['informer_id']);
             if (empty($template['error']) && !empty($template['code']) && !empty($template['items']) && isset($template['replace'])) {
                 $compiled = $engine->compileWithItems($template['code'], $template['items'], $template['replace']);
             }
             $this->cache->set($cacheKey, $compiled);
         }
         return $engine->render($compiled, $data['params']);
     } else {
         return '';
     }
 }
开发者ID:deliverynetwork,项目名称:informers-client-php,代码行数:26,代码来源:Client.php


示例12: renderNavBar

function renderNavBar()
{
    //Conexion a la BD
    $db = DBManager::getInstance();
    $db->connect();
    $dbm = Driver::getInstance();
    $navBar = new TemplateEngine();
    //---x---x--- Por defecto ---x---x---
    $navBar->log = 0;
    //el usuario NO está logeado
    $navBar->admin = 0;
    //por lo tanto no puede ser administrador
    $navBar->materia = 0;
    //ni administrador de materia
    $navBar->user_id = null;
    //y no hay ID de usuario
    //Se ha hecho login?
    if (isset($_SESSION["name"])) {
        //---x---x--- Si se ha hecho... ---x---x---
        $navBar->log = 1;
        //el usuario está logeado
        $usuario = new Usuario($dbm);
        $usuario = $usuario->findBy('user_name', $_SESSION['name']);
        //CAMBIAME
        $navBar->user_id = $usuario[0]->getUser_id();
        //El usuario es un administrador?
        if ($db->existUserRol($_SESSION["name"], "AdminApuntorium")) {
            $navBar->admin = 1;
            //el usuario es administrador
        } else {
            //El usuario es administrador de materia?
            $administra = new Administra($dbm);
            if ($administra->findBy('user_id', $usuario[0]->getUser_id()) != null) {
                $navBar->materia = 1;
                //el usuario administra una materia
            }
        }
    } else {
    }
    return $navBar->render('navbar_v.php');
}
开发者ID:MOGP95,项目名称:ET3,代码行数:41,代码来源:navbar.php


示例13: getInstance

 /**
  * Returns an instance of template engine driver.
  * If the requested driver is already created, the same instance is returned.
  *
  * @param string $driver Name of the template engine driver. Must correspond to components.template_engine.engines.{$driver}.
  *
  * @return \Webiny\Component\TemplateEngine\Bridge\TemplateEngineInterface
  * @throws TemplateEngineException
  * @throws \Exception
  */
 static function getInstance($driver)
 {
     if (isset(self::$instances[$driver])) {
         return self::$instances[$driver];
     }
     $driverConfig = TemplateEngine::getConfig()->get('Engines.' . $driver, false);
     if (!$driverConfig) {
         throw new TemplateEngineException('Unable to read driver configuration: TemplateEngine.Engines.' . $driver);
     }
     try {
         self::$instances[$driver] = TemplateEngineBridge::getInstance($driver, $driverConfig);
         return self::$instances[$driver];
     } catch (\Exception $e) {
         throw $e;
     }
 }
开发者ID:Webiny,项目名称:Framework,代码行数:26,代码来源:TemplateEngineLoader.php


示例14: init

 protected function init($name) {
     Logger::enter_group('Template');
     Logger::debug('Loading Template');
     $this->name = $name;
     
     $this->tpl_engine = TemplateEngine::instance();
     $this->tpl_engine->set_opts(array(
         'loader' => array(
             APP_ROOT . "/views/",
             APP_ROOT . "/views/" . $this->name
         ),
         'cache' => Config::instance('framework')->get_value('cache'),
         'debug' => Config::instance('framework')->get_value('debug')
     ));
     $this->tpl_engine->load();
 }
开发者ID:reddragon010,项目名称:RG-ServerPanel,代码行数:16,代码来源:Template.php


示例15: redirectURI

if ($user != null && $user->checkPermissions(1, 1)) {
    // falls Admin-Rechte
    $isAdmin = 1;
} else {
    $isAdmin = 0;
    if ($user != null && $user->checkPermissions(0, 0, 0, 1, 1)) {
        // wenn ORDERER
        redirectURI("/orderer/index.php");
    }
    if ($user != null && $user->checkPermissions(0, 0, 1)) {
        // wenn USER
        redirectURI("/user/index.php");
    }
}
$LOG = new Log();
$tpl = new TemplateEngine("template/viewProduct.html", "template/frame.html", $lang["viewer_viewProduct"]);
$LOG->write('3', 'viewer/viewProduct.php');
$pID = $_GET['pID'];
$tpl->assign('ID', $pID);
//Produktdaten
$product_query = DB_query("SELECT\n\t\t\t\t*\n\t\t\t\tFROM products\n\t\t\t\tWHERE products_id = " . $pID . "\n\t\t\t\tAND deleted = 0\n\t\t\t\tORDER BY sort_order, name\n\t\t\t\t");
$product = DB_fetchArray($product_query);
$tpl->assign('name', $product['name']);
$tpl->assign('description', $product['description']);
//$tpl->assign('sort_order',$product['sort_order']);
$tpl->assign('active', $product['active']);
// zur Unterscheidung, ob anzeigbar, weiterhin mitliefern
$tpl->assign('image_small', $product['image_small']);
$tpl->assign('image_big', $product['image_big']);
$tpl->assign('stock', $product['stock']);
$tpl->assign('price', $product['price']);
开发者ID:BackupTheBerlios,项目名称:wpp-svn,代码行数:31,代码来源:viewProduct.php


示例16: Cancerbero

require_once '../cancerbero/cancerbero.php';
$cerb = new Cancerbero('AP_MisTitulaciones');
$cerb->handleAuto();
//Includes iniciales
require_once '../views/templateEngine.php';
// se carga la clase TemplateEngine
require_once '../model/Titulacion.php';
require_once '../model/Usuario.php';
require_once '../model/driver.php';
require_once 'navbar.php';
//Inclusión de navbar. Omitible si no la necesita
//Conexion a la BD
$db = Driver::getInstance();
//Instancias TemplateEngine, renderizan elementos
$renderMain = new TemplateEngine();
$rendermistit = new TemplateEngine();
$titulaciones = new Titulacion($db);
$usuario = new Usuario($db);
$usuario = $usuario->findBy('user_name', $_SESSION['name']);
$misTitulaciones = $usuario[0]->titulaciones();
$alltitulaciones = $titulaciones->all();
$rendermistit->misTitulaciones = $misTitulaciones;
$rendermistit->allTitulaciones = $alltitulaciones;
$renderMain->title = "Mis titulaciones";
//Titulo y cabecera de la pagina
$renderMain->navbar = renderNavBar();
//Inserción de navBar en la pagina. Omitible si no la necesita
$renderMain->content = $rendermistit->render('misTitulaciones_v.php');
//Inserción del contenido de la página
echo $renderMain->renderMain();
// Dibujado de la página al completo
开发者ID:nemoNoboru,项目名称:ET3,代码行数:31,代码来源:mistitulaciones.php


示例17: handleUserPost

 private function handleUserPost()
 {
     $request = Request::getInstance();
     $user = new NewsLetterUser($this->plugin);
     $usr_used = $request->getValue('usr_used');
     if (!$usr_used) {
         $usr_used = array();
     }
     try {
         if (!$request->exists('id')) {
             throw new Exception('User group is missing.');
         }
         $id = intval($request->getValue('id'));
         $key = array('id' => $id);
         $this->removeUser($key);
         foreach ($usr_used as $item) {
             $user->addGroup(array('id' => $item), $key);
         }
         viewManager::getInstance()->setType(NewsLetter::VIEW_GROUP_OVERVIEW);
         $this->handleOverview();
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('errorMessage', $e->getMessage(), false);
         $this->handleUserGet(false);
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:26,代码来源:NewsLetterGroup.php


示例18: handleTreeDeletePost

 private function handleTreeDeletePost()
 {
     $request = Request::getInstance();
     $values = $request->getRequest(Request::POST);
     try {
         if (!$request->exists('id')) {
             throw new Exception('Post ontbreekt.');
         }
         $id = $request->getValue('id');
         $key = array('id' => $id);
         $this->delete($key);
         viewManager::getInstance()->setType(Calendar::VIEW_COMMENT_OVERVIEW);
         $this->handleHttpGetRequest();
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('errorMessage', $e->getMessage(), false);
         $this->handleTreeDeleteGet();
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:19,代码来源:CalendarComment.php


示例19: handleExtensionForm

 private function handleExtensionForm($theme)
 {
     $request = Request::getInstance();
     try {
         if (!$request->exists('ext_id')) {
             throw new Exception('Extension ontbreekt.');
         }
         $id = intval($request->getValue('ext_id'));
         $extension = $this->director->extensionManager->getExtensionFromId(array('id' => $id));
         $extension->renderForm($theme);
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('errorMessage', $e->getMessage(), false);
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:15,代码来源:ExtensionHandler.php


示例20: handleAdminSubLinks

 /**
  * handle navigation for sub classes / pages
  */
 public function handleAdminSubLinks($keyName, $title, $addBreadcrumb = false)
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $template = new TemplateEngine();
     if (!$request->exists('nl_id')) {
         return;
     }
     $nl_id = $request->getValue('nl_id');
     $newsLetterName = $this->getName(array('id' => $nl_id));
     $template->setVariable('pageTitle', $newsLetterName, false);
     $tree_id = $request->getValue('tree_id');
     $tag = $request->getValue('tag');
     $template->setVariable('tree_id', $tree_id, false);
     $template->setVariable('tag', $tag, false);
     $template->setVariable('nl_id', $nl_id, false);
     if (!$addBreadcrumb) {
         return;
     }
     $url = new Url(true);
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     $url->setParameter('id', $nl_id);
     $url->setParameter($view->getUrlId(), ViewManager::TREE_EDIT);
     $breadcrumb = array('name' => $newsLetterName, 'path' => $url->getUrl(true));
     $this->addBreadcrumb($breadcrumb);
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:30,代码来源:Theme.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TemplateHandler类代码示例发布时间:2022-05-23
下一篇:
PHP Template类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap