本文整理汇总了PHP中Template::build方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::build方法的具体用法?PHP Template::build怎么用?PHP Template::build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::build方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
public function generate()
{
$tmpl = new Template();
$tmpl->curr = $this->cur_page;
$tmpl->menu = array(
"display" => array(
"Home",
"Menu",
"Pay",
"Logout"
),
"link" => array(
"index.php",
"order.php",
"checkout.php",
"login.php?logout=true"
)
);
$css = $tmpl->build('header.css');
$html = $tmpl->build('header.html');
//$js = $tmpl->build('header.js');
$content = array('html' => $html, 'css' => $css, 'js' => $js);
return $content;
}
示例2: generate
public function generate()
{
$tmpl = new Template();
$css = $tmpl->build('footer.css');
$html = $tmpl->build('footer.html');
//$js = $tmpl->build('footer.js');
$content = array('html' => $html, 'css' => array('code' => $css, 'link' => 'footer'), 'js' => $js);
return $content;
}
示例3: generate
public function generate()
{
$tmpl = new Template();
$tmpl->ing_labels = $this->ing_labels;
$css = $tmpl->build('ingredients.css');
$html = $tmpl->build('ingredients.html');
//$js = $tmpl->build('menubar.js'); // For any JS related to the menubar
$content = array('html' => $html, 'css' => $css, 'js' => $js);
return $content;
}
示例4: generate
public function generate($view)
{
$tmpl = new Template();
$tmpl->item_info = $this->item_info;
$tmpl->view = $view;
$tmpl->ing_labels = $this->ing_labels;
$css = $tmpl->build('menuitem.css');
$html = $tmpl->build('menuitem.html');
//$js = $tmpl->build('menubar.js'); // For any JS related to the menubar
$content = array('html' => $html, 'css' => $css, 'js' => $js);
return $content;
}
示例5: testBuild
/**
* @depends testInterface
* @return null
*/
public function testBuild()
{
$data = array('foo' => 'bar', 'baz' => array(1, 2, 3));
$this->template->setStatus(3001, "Custom Message")->load($data);
$expected = '{"code":3001,"message":"Custom Message",';
$expected .= '"data":{"foo":"bar","baz":[1,2,3]}}';
$this->assertEquals($expected, $this->template->build());
}
示例6: build
public function build($appContent){
$tmpl = new Template();
$tmpl->headerContent = $this->header->generate();
$tmpl->appContent = $appContent;
$tmpl->footerContent = $this->footer->generate();
$tmpl->title = $this->page_title;
$tmpl->id = $this->body_id;
return $tmpl->build('page.html');
}
示例7: build
public function build($appContent) {
$tmpl = new Template();
$tmpl->headerContent = $this->header->generate();
$tmpl->menuContent = $this->curr == 1 ? $this->menu->generate() : "";
$tmpl->menuItem = ($this->curr == 1) ? $this->menuItem->generate($this->curr) : "";
$tmpl->appContent = $appContent;
$tmpl->title = $this->page_title;
return $tmpl->build('page.html');
}
示例8: resolveParams
/**
* general bypass for unhandled tag attributes
* @param array $params
* @return string
*/
protected function resolveParams(array $params)
{
$out = '';
foreach ($params as $key => $value) {
// build dynamic tokens
if (preg_match('/{{(.+?)}}/s', $value)) {
$value = $this->template->build($value);
}
if (preg_match('/{{(.+?)}}/s', $key)) {
$key = $this->template->build($key);
}
// inline token
if (is_numeric($key)) {
$out .= ' ' . $value;
} elseif ($value == NULL) {
$out .= ' ' . $key;
} else {
$out .= ' ' . $key . '="' . $value . '"';
}
}
return $out;
}
示例9: _body
/**
* auto-append footer slot marker into <body>
* @param $node
* @return string
*/
public function _body($node)
{
$params = '';
if (isset($node['@attrib'])) {
$params = $this->resolveAttr($node['@attrib']);
unset($node['@attrib']);
}
$content = array();
// bypass inner content nodes
foreach ($node as $el) {
$content[] = $this->template->build($el);
}
return '<body' . $params . '>' . implode("\n", $content) . "\n" . $this->render('footer') . "\n" . '</body>';
}
示例10: build
public function build()
{
$pref = new Pref("system");
$this->setMainTemplate($pref->template);
$tpl = new Template(PATH_TEMPLATES);
if (!USER_ID && !$this->isAllowed()) {
header("location: " . page("user", "login"));
}
if (!USER_ID && $this->isAllowed()) {
$tpl->login = true;
} else {
$tpl->login = false;
}
$tpl->loadFile("template.php");
$tpl->data = $this->data;
$tpl->build();
}
示例11: template
function template($tpl)
{
global $sys;
$tpl_dir = ZH . "/tpl";
$cache_dir = ZH_TMP . "/tpl";
if (!file_exists("{$tpl_dir}/{$sys->theme}/{$tpl}.tpl.php")) {
$theme = 'zh';
} else {
$theme = $sys->theme;
}
$tplfile = "{$tpl_dir}/{$theme}/{$tpl}.tpl.php";
$objfile = "{$cache_dir}/{$theme}.{$tpl}.cache.php";
$langfile = "{$tpl_dir}/{$theme}/lang.ini.php";
if (!file_exists($objfile) || filemtime($objfile) < max(filemtime($tplfile), filemtime($langfile))) {
$t = new Template();
$t->build($tplfile, $objfile);
$t = null;
}
return $objfile;
}
示例12: RedirectBrowserException
unset($img);
//start a session and store a variable;
setSession(0,'/'); // expires with browser session, the root is '/'
setSessionVar('foo', 'bar'); //there's no retrieval function, so this is kind of stupid
if( !isset($_SESSION['foo']) ){
throw new RedirectBrowserException("example.php");
}
//Database calls
/*
$db = new Database("username", "password", "database name", "location of database", "type of database"); // currently only supports "mysql"
$sql = "SELECT * FROM mytable WHERE myid=?";
$values = array(4); // myid
$result = $db->qwv($sql, $values); // query with values, returns array of rows (can be empty)
if( $db->stat() ) // <-- the boolean representing whether the last query was successful{
foreach( $result as $row ){
print $row['myid'] . "<br />";
}
}
$sql = "INSERT INTO mytable VALUES (4)";
$db->q($sql); // query (no values), returns array of rows (can be empty)
Database.php is fully top-commented
*/
print $tmpl->build('example.html');
?>
示例13: generate
public function generate()
{
$tmpl = new Template();
$tmpl->curr = $this->cur_page;
if( isset($_SESSION['umbrella']['tableid']) && !isset($_SESSION['userid']) )
{
$this->setGuest($_SESSION['umbrella']['tableid']);
}
if( $_SERVER['QUERY_STRING'] != null )
{
$qs = $_SERVER['QUERY_STRING'];
$st = explode("&", $qs);
$vals = array();
foreach($st as $string)
{
$pair = explode("=", $string);
$vals[$pair[0]] = $pair[1];
}
//array of available testing tables
$tables = array(1);
$tid = hexdec($vals['hor']) / 1000;
if( in_array($tid, $tables) )
{
$_SESSION['umbrella']['tableid'] = $tid;
$this->setGuest($tid);
header('Location: index.php');
}
}
if( $_SERVER['SCRIPT_NAME'] != '/error.php' )
{
if( ($_SERVER['SCRIPT_NAME'] != '/login.php' && !isset($_SESSION['umbrella']['tableid'])) )
{
if( $_SESSION['roleid'] > 2 )
{
$loc = urlencode("login.php?code=11");
header('Location: login.php?action=logout&fwd='.$loc);
}
else
{
if( $_SERVER['SCRIPT_NAME'] != '/table.php' )
{
header('Location: table.php?code=0');
}
}
}
}
if( $_SESSION['active'] )
{
$tmpl->menu = Navigation::getByRole($_SESSION['roleid']);
array_push($tmpl->menu, new Navigation(
null,
"Logout",
"/login.php?action=logout",
'user',
4,
0
));
}
else
{
$tmpl->menu = Navigation::getByRole(4);
array_push($tmpl->menu, new Navigation(
null,
"Login",
"/login.php",
'user',
4,
0
));
}
$css = $tmpl->build('header.css');
$html = $tmpl->build('header.html');
$js = $tmpl->build('header.js');
$content = array('html' => $html, 'css' => array('code' => $css, 'link' => 'header'), 'js' => $js);
return $content;
}
示例14: array
break;
case 13:
$tmpl->message = "Adding item succeeded.";
$tmpl->css = "okay";
break;
case 14:
$tmpl->message = "Updating item succeeded.";
$tmpl->css = "okay";
break;
default:
break;
}
$page->run();
$html = $tmpl->build('item.html');
$css = $tmpl->build('item.css');
$js = $tmpl->build('item.js');
$appContent = array(
'html' => $html,
'css' => array( 'code' => $css,
'link' => 'item'
),
'js' => $js
);
print $page->build($appContent);
function checkLogin($roles)
{
示例15: Page
<?php
set_include_path('backbone:components:content:scripts:styles:images:model:render');
require_once('Page.php');
require_once('Template.php');
$page = new Page(0, "OrderUp - improve your dining");
$tmpl = new Template();
$page->run();
$html = $tmpl->build('index.html');
$css = $tmpl->build('index.css');
//$js = $tmpl->build('index.js');
$appContent = array(
'html' => $html,
'css' => array( 'code' => $css,
'link' => 'index'
),
'js' => $js
);
print $page->build($appContent);
?>