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


PHP renderTemplate函数代码示例

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


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

示例1: index

function index()
{
    global $_controller, $_action;
    $alias = isset($params['alias']) ? $params['alias'] : 'index';
    $data = array('goods' => getGoodsList());
    $path = TEMPLATES_PATH . "/{$_controller}/{$_action}.ctp";
    return renderTemplate($path, $data);
}
开发者ID:gorbuz9kin,项目名称:Homework,代码行数:8,代码来源:goods.controller.php

示例2: renderAccountPageHeader

function renderAccountPageHeader($hooks = array())
{
    global $master_account;
    if (isset($_SESSION["userCakeUser"]) && is_object($_SESSION["userCakeUser"]) and $_SESSION["userCakeUser"]->user_id == $master_account) {
        $hooks["#SB_STYLE#"] = 'sb-admin-master.css';
    } else {
        $hooks["#SB_STYLE#"] = 'sb-admin.css';
    }
    return renderTemplate(ACCOUNT_HEAD_FILE, $hooks);
}
开发者ID:lilfade,项目名称:UserFrosting,代码行数:10,代码来源:template_functions.php

示例3: generateModel

function generateModel($table, $allColumns, $foreignKeys, $modelsPath)
{
    $columns = $allColumns[$table];
    $params = ['table' => $table, 'class_name' => Inflector::classify($table), 'validations' => generateValidationRules($columns), 'columns' => getPrettyColumns($columns), 'display_col' => getDisplayColumn($columns), 'auto_joins' => !empty($foreignKeys['foreign_keys'][$table]) ? getAutoJoins($foreignKeys['foreign_keys'][$table], $allColumns) : ''];
    $output = renderTemplate($params);
    //$associations  = '';//static::generateAssociations($table, $foreignKeys, $columns);
    $file = $modelsPath . $params['class_name'] . '.php';
    $keep = file_exists($file) ? StringUtils::between('//START', '//END', file_get_contents($file)) : '';
    $keep = trim($keep);
    $tpl = str_replace('//START//END', "//START\n\n\t{$keep}\n\n    //END", $output);
    FileUtils::createDirectoriesAndSaveFile($file, $tpl);
}
开发者ID:terah,项目名称:fluent-pdo-model,代码行数:12,代码来源:generate.php

示例4: renderTemplate

function renderTemplate($__basedir, $template, array $__templateData = array())
{
    $render = function ($__path, array $__templateData = array()) use($__basedir) {
        $render = function ($template, array $data = array()) use($__basedir) {
            return renderTemplate($__basedir, $template, $data);
        };
        ob_start();
        extract($__templateData);
        unset($__templateData);
        include $__basedir . '/../templates/' . $__path . '.php';
        return ob_get_clean();
    };
    return $render($template, $__templateData);
}
开发者ID:barnabywalters,项目名称:silex-starter,代码行数:14,代码来源:hacks.php

示例5: define

 * Generate the EnlighterJS Documentation Pages
 * @author Andi Dittrich
 * @license MIT Style X11
 */
// Get Build Version
define('EJS_VERSION', count($argv) >= 3 ? $argv[2] : 'unknown');
define('EJS_PACKAGE_ZIP', 'https://github.com/AndiDittrich/EnlighterJS/archive/v' . EJS_VERSION . '.zip');
define('EJS_PACKAGE_TGZ', 'https://github.com/AndiDittrich/EnlighterJS/archive/v' . EJS_VERSION . '.tar.gz');
require 'global.php';
// === GETTING STARTED ============================================================
renderTemplate($outputDir . 'index.html', array('PAGE' => 'Resources/Pages/GettingStarted.phtml', 'title' => 'EnlighterJS', 'subtitle' => 'An OpenSource Syntax Highlighter'));
// === Changelog ============================================================
renderTemplate($outputDir . 'Changelog.html', array('PAGE' => 'Resources/Pages/Changelog.phtml', 'title' => 'Changelog', 'subtitle' => 'The History of EnlighterJS'));
// === Documentation ============================================================
renderTemplate($outputDir . 'Documentation.html', array('PAGE' => 'Resources/Pages/Documentation.phtml', 'title' => 'Documentation', 'subtitle' => 'Feature Reference'));
// === Languages ============================================================
foreach ($languageExamples as $currentLanguage) {
    renderTemplate($outputDir . 'Language.' . $currentLanguage . '.html', array('PAGE' => 'Resources/Pages/Languages.phtml', 'title' => 'Languages', 'subtitle' => 'Build-In Support', 'currentLanguage' => $currentLanguage, 'languageExamples' => $languageExamples, 'themes' => $themes));
}
// === Themes ============================================================
foreach ($themes as $theme) {
    renderTemplate($outputDir . 'Theme.' . $theme . '.html', array('PAGE' => 'Resources/Pages/Themes.phtml', 'title' => 'Themes', 'subtitle' => 'Enlighter`s Appearance', 'theme' => $theme, 'themes' => $themes));
}
// === Builder ============================================================
renderTemplate($outputDir . 'Builder.html', array('PAGE' => 'Resources/Pages/Builder.phtml', 'title' => 'Builder', 'subtitle' => 'Customized EnlighterJS Packages', 'languages' => $languageDescriptions));
// === Plugins ============================================================
renderTemplate($outputDir . 'Plugins.html', array('PAGE' => 'Resources/Pages/Plugins.phtml', 'title' => 'Plugins', 'subtitle' => 'Extend, Integrate'));
function renderTemplate($destination, $vars = array())
{
    file_put_contents($destination, captureTemplate('Resources/Web.phtml', $vars));
}
开发者ID:Krusen,项目名称:EnlighterJS,代码行数:31,代码来源:PageGenerator.php

示例6: generarPDF

function generarPDF()
{
    $request = \Slim\Slim::getInstance()->request();
    $val = $request->params();
    $idproyecto = $val["idproyecto"];
    //obtener datos del alcance
    $con = getConnection();
    $pstmt = $con->prepare("SELECT *  FROM ALCANCE  WHERE id_proyecto= ?");
    $pstmt->execute(array($idproyecto));
    $alcance = $pstmt->fetch(PDO::FETCH_ASSOC);
    $pstmt = $con->prepare("SELECT nombre_proyecto \n\t\t\tFROM PROYECTO\n\t\t\tWHERE id_proyecto = ? \n\t\t");
    $pstmt->execute(array($idproyecto));
    if ($id = $pstmt->fetch(PDO::FETCH_ASSOC)) {
        $alcance["proyecto"] = $id["nombre_proyecto"];
    }
    //obtener el archivo plantilla
    $html = file_get_contents('../views/alcance/plantillaPDFAlcance.html');
    //reemplazar las variables de la plantilla
    $outputHtml = renderTemplate($html, $alcance);
    //crear el pdf
    $dompdf = new DOMPDF();
    $dompdf->load_html($outputHtml);
    $dompdf->render();
    //setear el response como stream de bytes
    \Slim\Slim::getInstance()->response->headers->set('Content-Type', 'application/pdf');
    //devolver el archivo COMO STREAM
    return $dompdf->stream("Alcance.pdf");
}
开发者ID:jdaniel14,项目名称:dp2-software,代码行数:28,代码来源:serviciosAlcance.php

示例7: renderTemplate

			</div>
		  </div>
		  <div class="form-group">
			<div class="col-md-offset-3 col-md-6">
			  <input type="email" class="form-control" placeholder="Email" name='email'>
			</div>
		  </div>
		  <div class="form-group">
			<div class="col-md-12">
			  <button type="submit" class="btn btn-success submit" value='Resend'>Resend Activation</button>
			</div>
		  </div>
		</form>
      </div>	
      <?php 
echo renderTemplate("footer.html");
?>

    </div> <!-- /container -->

	<script>
        $(document).ready(function() {          
			// Load the header
			$(".navbar").load("header-loggedout.php", function() {
				$(".navbar .navitem-login").addClass('active');
			});
		  	
			alertWidget('display-alerts');
			  
		  	$("form[name='resend']").submit(function(e){
				var form = $(this);
开发者ID:lilfade,项目名称:UserFrosting,代码行数:31,代码来源:resend_activation.php

示例8: exit

        $data = $control->_call('on' . $action, '');
    } else {
        exit('Action not found!');
    }
    if (method_exists($control, 'on_afterhandler')) {
        $m = 'on_afterhandler';
        $control->{$m}();
    }
    if (isset($data)) {
        //ob_clean();
        header('Content-Type: application/json; charset=UTF-8');
        $ret = json_encode($data);
    } else {
        header('Content-type: text/html; charset=UTF-8');
    }
} catch (Exception $e) {
    $error_msg = $e->__toString();
    $ret = json_encode(array('status' => 'ERROR', 'error_code' => $e->getCode(), 'error_msg' => $e->getMessage()));
}
$callback = getGPC('callback', 'string');
if (!empty($callback)) {
    $ret = "{$callback}({$ret});";
}
if (!empty($ret)) {
    die($ret);
}
if (!empty($view_datas)) {
    extract($view_datas, EXTR_SKIP);
}
@(include renderTemplate($module, $action));
开发者ID:EricZRY,项目名称:raspcloud,代码行数:30,代码来源:admincp.php

示例9: testXMLTemplates

    public function testXMLTemplates()
    {
        $data = renderTemplate('dates/seminar_xml', $this->testData);
        $compare = '<raumzeit>
    <startwoche>0</startwoche>
    <datum>wöchentlich</datum>
    <wochentag>Montag</wochentag>
    <zeit>10:00-12:00</zeit>
    <raum>
        <gebucht>Hörsaal 1 &lt;br&gt;</gebucht>
        <freitext>&lt;script&gt;alert(&quot;böse&quot;);&lt;/script&gt;</freitext>
    </raum>
</raumzeit>
<raumzeit>
    <datum>12.05.2010</datum>
    <wochentag>Mittwoch</wochentag>
    <zeit>09:00-13:00</zeit>
    <raum>
        <gebucht></gebucht>
        <freitext>&lt;script&gt;alert(&quot;böse&quot;);&lt;/script&gt;</freitext>
    </raum>
</raumzeit>';
        $this->assertEquals($compare, $data);
        $data = renderTemplate('dates/date_xml', $this->testData, array('date' => new SingleDate()));
        $compare = '<date>Mo., 11.11.2010 12:00 - 14:00, Ort: Hörsaal 1 &lt;br&gt;</date>';
        $this->assertEquals($compare, $data);
    }
开发者ID:ratbird,项目名称:hope,代码行数:27,代码来源:DateTemplatesTest.php

示例10: makePage

function makePage($template, $layout)
{
    $result = renderTemplate($template);
    $result = renderLayout($result, $layout);
    return $result;
}
开发者ID:aercolino,项目名称:tech-test,代码行数:6,代码来源:functions.php

示例11: cdnbase

/**
 * Generate the EnlighterJS Example Pages
 * @author Andi Dittrich
 * @license MIT Style X11
 */
function cdnbase($file)
{
    global $argv;
    // Local Examples or Webbuild ?
    if (isset($argv[2]) && trim($argv[2]) == 'www') {
        return basename($file);
    } else {
        return '../' . $file;
    }
}
require 'global.php';
// setup metainit string
$metainit = '<meta name="EnlighterJS" content="Advanced javascript based syntax highlighting" data-language="javascript" data-indent="2" data-selector-block="pre" data-selector-inline="code" />';
// === Basic Examples =================================================
renderTemplate($outputDir . 'Example1.html', array('page' => 'Resources/ExampleData/Example1.phtml', 'pageTitle' => 'Basic EnlighterJS Example', 'header' => $metainit));
renderTemplate($outputDir . 'Example2-jsinit.html', array('page' => 'Resources/ExampleData/Example2-jsinit.phtml', 'pageTitle' => 'Javascript Initialization Example', 'header' => ''));
renderTemplate($outputDir . 'Example3-advanced.html', array('page' => 'Resources/ExampleData/Example3-advanced.phtml', 'pageTitle' => 'Advanced Javascript Example', 'header' => ''));
/**
 * Renders the template file and return HTML
 * @param Array $vars
 */
function renderTemplate($destination, $vars = array())
{
    file_put_contents($destination, captureTemplate('Resources/ExampleTemplate.phtml', $vars));
}
开发者ID:Krusen,项目名称:EnlighterJS,代码行数:30,代码来源:ExampleGenerator.php

示例12: array

require "admin/moddate.php";
$requestMapping = array("home" => 1, "produkte" => 2, "bestellung" => 3, "projekte" => 4, "links" => 5, "kontakt" => 6, "impressum" => 7, "agb" => 8);
$base = isset($base) ? $base : "home";
$id = $requestMapping[$base];
$res = getPageContents($id);
$viewModel = array("siteBase" => SITE_BASE, "title" => $res["title"], "content" => $res["content"], "lastModification" => getLastModificationDate());
if ($base == "produkte") {
    $viewModel["onProductPage"] = true;
    $viewModel["items"] = loadProducts();
} else {
    if ($base == "bestellung") {
        $viewModel["onOrderPage"] = true;
        $viewModel["items"] = loadProducts();
    }
}
renderTemplate("page-base", $viewModel);
function loadProducts()
{
    global $mysqli;
    $p = array();
    $res = $mysqli->query("select id, title, description, category, price, image from jube_items order by id");
    while ($row = $res->fetch_assoc()) {
        if (!$p[$row["category"]]) {
            $p[$row["category"]] = array();
        }
        $item = array("id" => $row["id"], "title" => $row["title"], "description" => $row["description"], "price" => formatPrice($row["price"]), "category" => $row["category"]);
        if (!empty($row["image"])) {
            $item["thumb"] = PUBLIC_MEDIA_DIR . $row["image"] . "/size_thumb.jpg";
            $item["large"] = PUBLIC_MEDIA_DIR . $row["image"] . "/size_large.jpg";
        }
        $p[$row["category"]][] = $item;
开发者ID:newcron,项目名称:juebe-modelle,代码行数:31,代码来源:index.php

示例13: renderTemplate

function renderTemplate($template_block, $context)
{
    $renderedHTML = "";
    $foreachIsOpen = false;
    $ifIsOpen = false;
    $ifCondition = false;
    $ifNotIsOpen = false;
    $ifNotCondition = false;
    $innerBlock = array();
    $currentContext = "";
    foreach ($template_block as $node) {
        //buscando si es un cierre de foreach
        if (strpos($node, "{{endfor {$currentContext}}}") !== false) {
            if ($foreachIsOpen) {
                $foreachIsOpen = false;
                if (isset($context[$currentContext])) {
                    foreach ($context[$currentContext] as $forcontext) {
                        $renderedHTML .= renderTemplate($innerBlock, $forcontext);
                    }
                }
                $innerBlock = array();
                $currentContext = "";
                continue;
            }
        }
        //buscando si es un cierre de if
        if (strpos($node, "{{endifnot {$currentContext}}}") !== false) {
            if ($ifNotIsOpen) {
                $ifNotIsOpen = false;
                $renderedHTML .= $ifNotCondition ? renderTemplate($innerBlock, $context) : "";
                $currentContext = "";
                $innerBlock = array();
                $ifNotCondition = false;
                continue;
            }
        }
        if (strpos($node, "{{endif {$currentContext}}}") !== false) {
            if ($ifIsOpen) {
                $ifIsOpen = false;
                $renderedHTML .= $ifCondition ? renderTemplate($innerBlock, $context) : "";
                $currentContext = "";
                $innerBlock = array();
                $ifCondition = false;
                continue;
            }
        }
        if ($foreachIsOpen || $ifIsOpen || $ifNotIsOpen) {
            $innerBlock[] = $node;
            continue;
        }
        //buscando si es una apertura de foreach
        if (strpos($node, "{{foreach") !== false) {
            if (!$foreachIsOpen) {
                $foreachIsOpen = true;
                $currentContext = trim(str_replace("}}", "", str_replace("{{foreach", "", $node)));
                continue;
            }
        }
        //buscando si es un if
        if (strpos($node, "{{ifnot") !== false) {
            if (!$ifNotIsOpen) {
                $ifNotIsOpen = true;
                $currentContext = trim(str_replace("}}", "", str_replace("{{ifnot", "", $node)));
                if (isset($context[$currentContext])) {
                    $ifNotCondition = $context[$currentContext] == false;
                }
                continue;
            }
        }
        if (strpos($node, "{{if") !== false) {
            if (!$ifIsOpen) {
                $ifIsOpen = true;
                $currentContext = trim(str_replace("}}", "", str_replace("{{if", "", $node)));
                if (isset($context[$currentContext])) {
                    $ifCondition = $context[$currentContext] && true;
                }
                continue;
            }
        }
        //remplazando las variables del nodo
        $nodeReplace = preg_split("/(\\{\\{\\w*\\}\\})/", $node, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
        foreach ($nodeReplace as $item) {
            if (strpos($item, "{{") !== false) {
                $index = trim(str_replace("}}", "", str_replace("{{", "", $item)));
                $item = isset($context[$index]) ? $context[$index] : "";
            }
            $renderedHTML .= $item;
        }
    }
    return $renderedHTML;
}
开发者ID:josewfiallos,项目名称:boimcoWeb,代码行数:91,代码来源:template_engine.php

示例14: formatPrice

    if (!empty($amount)) {
        $product = $allItems[$id];
        if (!$product) {
            continue;
        }
        $product["amount"] = $amount;
        $totalPrice = $amount * $product["price"];
        $toPay += $totalPrice;
        $product["totalPrice"] = formatPrice($totalPrice);
        $product["price"] = formatPrice($product["price"]);
        $order[] = $product;
    }
}
date_default_timezone_set("Europe/Berlin");
$_POST["orderDate"] = date("d.m.Y H:i:s");
$_POST["itemsOrdered"] = $order;
$_POST["toPay"] = formatPrice($toPay);
$purchaseOrder = renderTemplateToString("purchase-order", $_POST);
$article = getPageContents(9);
$article["siteBase"] = SITE_BASE;
renderTemplate("page-base", array("title" => $article["title"], "content" => $article["content"], "siteBase" => SITE_BASE, "orderData" => json_encode($_POST), "orderDetails" => $purchaseOrder, "onConfirmOrderPage" => true));
function loadProducts()
{
    global $mysqli;
    $p = array();
    $res = $mysqli->query("select id, title, description, category, price from jube_items order by id");
    while ($row = $res->fetch_assoc()) {
        $p[$row["id"]] = array("id" => $row["id"], "title" => $row["title"], "description" => $row["description"], "price" => $row["price"], "category" => $row["category"]);
    }
    return $p;
}
开发者ID:newcron,项目名称:juebe-modelle,代码行数:31,代码来源:bestellung-abschicken.php

示例15: json_decode

<?php

require "settings.php";
require "mysql-connector.php";
require LIB_DIR . "/core/template.php";
$content = json_decode($_POST["order"]);
$content->{"standalone"} = true;
$headers = "Content-Type: text/html; charset=utf-8\n";
$mailContent = renderTemplateToString("purchase-order", $content);
$name = $content->{"name"};
$time = $content->{"orderDate"};
$subject = "Bestellung von {$name} um {$time}";
mail(ORDER_MAIL_TO, $subject, $mailContent, $headers);
mail($content->{"mail"}, "Kopie ihrer {$subject}", $mailContent, $headers);
$article = getPageContents(10);
$article["siteBase"] = SITE_BASE;
renderTemplate("page-base", $article);
开发者ID:newcron,项目名称:juebe-modelle,代码行数:17,代码来源:bestellung-abgeschickt.php


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