本文整理汇总了PHP中Template::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::create方法的具体用法?PHP Template::create怎么用?PHP Template::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Template::create([]);
}
}
示例2: __construct
public function __construct()
{
/**
* Fire up our templating engine.
*/
$this->template = Template::create();
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::all();
$validation = Validator::make($input, Template::$rules);
if ($validation->passes()) {
$this->template->create($input);
return Redirect::route('templates.index');
}
return Redirect::route('templates.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
}
示例4: create
public static function create($locaiton, $params = array(), $options = array())
{
$defaultOptions = array("bodyClass" => null, "troughLayout" => true, "appLayout" => "application", "header" => "header-partial", "footer" => "footer-partial");
foreach ($options as $key => $value) {
$defaultOptions[$key] = $value;
}
extract($defaultOptions);
if ($troughLayout) {
if (isset($bodyClass)) {
$bodyTemplate = new Template($locaiton, $params);
return new Template($appLayout, array("header" => Template::create($header, array(), array("troughLayout" => false)), "body" => $bodyTemplate->render(), "footer" => Template::create($footer, array(), array("troughLayout" => false)), "bodyClass" => $bodyClass));
} else {
$bodyTemplate = new Template($locaiton, $params);
return new Template($appLayout, array("body" => $bodyTemplate->render()));
}
} else {
return new Template($locaiton, $params);
}
}
示例5: unset
*/
$content->set('browser_title', 'Admin');
$content->set('body_class', 'inside');
/*
* Put the shorthand $body variable into its proper place.
*/
$content->set('body', '<div class="nest narrow">');
$content->append('body', '<h1>Admin</h1>');
$content->append('body', $body);
$content->append('body', '</div>');
unset($body);
/*
* Parse the template, which is a shortcut for a few steps that culminate in sending the content
* to the browser.
*/
$template = Template::create('admin');
$template->parse($content);
}
function show_admin_forms($args = array())
{
$parser = new ParserController($args);
$editions = $parser->get_editions();
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
$base_url = 'https://';
} else {
$edition_url_base = 'http://';
}
$edition_url_base .= $_SERVER['SERVER_NAME'];
if ($_SERVER['SERVER_PORT'] != 80) {
$edition_url_base .= ':' . $_SERVER['SERVER_PORT'];
}
示例6: Template
require_once "includes/cookie.php";
require_once "includes/template.php";
$body = new Template();
$cookie = new CookieInfo("CMS");
if ($cookie->check()) {
$cookie->getcookies();
if ($cookie->array['usertype'] == 2) {
header("Location: tl.php");
} else {
if ($cookie->array['usertype'] == 3) {
header("Location: dc.php");
} else {
if ($cookie->array['usertype'] == 4) {
header("Location: agent.php");
} else {
if ($cookie->array['usertype'] == 5) {
header("Location: it.php");
} else {
if ($cookie->array['usertype'] == 1) {
header("Location: agent.php");
}
}
}
}
}
exit;
}
$body->set_template("templates/index.html");
$body->add_key('errmsg', '');
echo $body->create();
示例7: array
<a href="main.php">return to index</a> |
<a href="TemplateHelp.html">Get your helpfile here!</a> |
<a href="editstyles.php">jump to stylesheets</a> |
<?php
$properties = array('btnSaveTemplate', 'selTemplate', 'btnNewTemplate', 'btnPickPublic', 'btnSaveTemplate', 'btnMakeMine', 'txtHeader', 'txtComment', 'txtFooter', 'chkTemplatePublic', 'iTemplatePublic', 'txtTemplateName', 'hdnTemplateId');
foreach ($properties as $property) {
${$property} = array_key_exists($property, $_REQUEST) ? $_REQUEST[$property] : null;
}
if (!empty($btnSaveTemplate)) {
$template = new Template($db);
$iTemplatePublic = 0;
if ($chkTemplatePublic == "on") {
$iTemplatePublic = 1;
}
if (-1 == $hdnTemplateId) {
$selTemplate = $template->create($hdnUserId, $iTemplatePublic, $txtHeader, $txtComment, $txtFooter, $txtTemplateName);
} else {
$template->update($hdnTemplateId, $hdnUserId, $iTemplatePublic, $txtHeader, $txtComment, $txtFooter, $txtTemplateName);
}
}
// Save the template preference change if required
if (!empty($_REQUEST['btnMakeMine'])) {
$TempQuery = " DELETE FROM UserTemplate WHERE i_UID = {$hdnUserId}";
$TempQueryId = mysql_query($TempQuery);
$TempQuery = "INSERT INTO UserTemplate VALUES ({$hdnUserId}, {$hdnTemplateId})";
$TempQueryId = mysql_query($TempQuery);
echo $TempQuery;
}
// get a drop-down of all the users templates.
$TemplateQuery = "SELECT i_TemplateID\n , vc_TemplateName\n FROM Template\n WHERE i_UID = {$hdnUserId}\n ORDER BY i_TemplateID";
$TemplateQueryId = mysql_query($TemplateQuery, $link);
示例8: unset
$body = '
<p>The page that you’re looking for is nowhere to be found. Sorry! Here are a few potential
solutions to the problem:</p>
<ul>
<li>Check the website address at the top of your browser. Do you see any obvious errors?
Fix ‘em!</li>
<li>Try using the search box, at the top of the page, to search for what you’re looking for.</li>
<li>Start over again <a href="/">at the home page</a> and try to browse your way to what you’re
trying to find.</li>
</ul>
<p>This problem has been noted in our records, and we’ll look into it!</p>';
/*
* Put the shorthand $body variable into its proper place.
*/
$content->set('body', $body);
unset($body);
/*
* Add the custom classes to the body.
*/
$content->set('body_class', 'law inside');
/*
* Fire up our templating engine.
*/
$template = Template::create();
/*
* Parse the template, which is a shortcut for a few steps that culminate in sending the content
* to the browser.
*/
$template->parse($content);
示例9: array
<?php
require_once './global.php';
require_once './helpers/secure.php';
$user = GenericHelper::getLoggedInUser();
$story_status_partial = Template::create("story-progress-partial", array("chapters" => Model_User::getChapters($user)), array("troughLayout" => false));
$loginPageTemplate = Template::create("loginpage", array("name" => $user->name, "birthday" => $user->date, "email" => $user->email, "story_status_partial" => $story_status_partial->render()), array("bodyClass" => "loginpage-body", "header" => "loged-in-header-partial"));
echo $loginPageTemplate;
示例10: array
<?php
require_once './global.php';
require_once './helpers/unsecure.php';
echo Template::create("test", false, null, array(a => "Hello"));
示例11: array
<?php
require_once './global.php';
require_once './helpers/unsecure.php';
$loginUnsuccessfulTemplate = Template::create("index", "index-body", array("err" => "There is no user with the given credentials."));
echo $loginUnsuccessfulTemplate;
示例12: run
public function run()
{
$template = Template::create(array('title' => 'Web Design'));
$deliverable = TemplateSection::create(array('template_id' => $template->id, 'section_type' => 'Deliverable', 'help_text' => 'This is the help text.', 'title' => 'Information Architecture', 'body' => 'This is the body of the deliverable. It is very awesome. Oh yeah.'));
$requirement = TemplateSection::create(array('template_id' => $template->id, 'section_type' => 'Requirement', 'help_text' => 'This is the help text.', 'title' => 'Open-sourced code.', 'body' => 'This is the body of the requirement. Mhm.'));
}
示例13: extract
<?php
require_once './global.php';
require_once './helpers/unsecure.php';
extract(GenericHelper::gatherGetData());
if (isset($err)) {
if ("login-unsuccessful" == $err) {
$indexTemplate = Template::create("index", array("err" => "There is no user with the given credentials"), array("bodyClass" => "index-body"));
} else {
if ("login-required" == $err) {
$indexTemplate = Template::create("index", array("err" => "Sorry, you have to login first to view this content."), array("bodyClass" => "index-body"));
} else {
$indexTemplate = Template::create("index", array(), array("bodyClass" => "index-body"));
}
}
} else {
$indexTemplate = Template::create("index", array(), array("bodyClass" => "index-body"));
}
echo $indexTemplate;
示例14:
<?php
require_once './global.php';
echo Template::create("login");
示例15: include_once
}else{
$errors['err']='Unknown command';
}
}
break;
default:
$errors['err']='Unknown topic action!';
}
break;
case 'templates':
include_once(INCLUDE_DIR.'class.msgtpl.php');
$do=strtolower($_POST['do']);
switch($do){
case 'add':
case 'create':
if(($tid=Template::create($_POST,$errors))){
$msg='Template created successfully';
}elseif(!$errors['err']){
$errors['err']='Error creating the template - try again';
}
break;
case 'update':
$template=null;
if($_POST['id'] && is_numeric($_POST['id'])) {
$template= new Template($_POST['id']);
if(!$template || !$template->getId()) {
$template=null;
$errors['err']='Unknown template'.$id;
}elseif($template->update($_POST,$errors)){
$msg='Template updated successfully';