public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Template::create([]); } }
public function __construct() { /** * Fire up our templating engine. */ $this->template = Template::create(); }
/** * 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.'); }
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); } }
*/ $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']; }
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();
<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);
$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);
<?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;
<?php require_once './global.php'; require_once './helpers/unsecure.php'; echo Template::create("test", false, null, array(a => "Hello"));
<?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;
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.')); }
<?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;
<?php require_once './global.php'; echo Template::create("login");
}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';
<?php require_once './global.php'; require_once './helpers/unsecure.php'; extract(GenericHelper::gatherGetData()); $notLoggedInTemplate = Template::create("not-logged-in", array("loginForm" => Template::create("login"))); echo $notLoggedInTemplate;
/** * Test support for late static binding. * * With late static binding introduced in PHP 5.3, AbstractTemplate::create() * should create a new instance of the child class without the need for * overriding the static create method. * * Note that the Template class used in this test should not declare a * create() method. */ public function testCreate() { $this->assertInstanceOf('Template', Template::create('foo-succeed')); }
$msg = 'Message template updated successfully'; } elseif (!$errors['err']) { $errors['err'] = 'Error updating message template. Try again!'; } break; case 'update': if (!$template) { $errors['err'] = 'Unknown or invalid template'; } elseif ($template->update($_POST, $errors)) { $msg = 'Template updated successfully'; } elseif (!$errors['err']) { $errors['err'] = 'Error updating template. Try again!'; } break; case 'add': if (Template::create($_POST, $errors)) { $msg = 'Template added successfully'; $_REQUEST['a'] = null; } elseif (!$errors['err']) { $errors['err'] = 'Unable to add template. Correct error(s) below and try again.'; } break; case 'mass_process': if (!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) { $errors['err'] = 'You must select at least one template to process.'; } else { $count = count($_POST['ids']); if ($_POST['enable']) { $sql = 'UPDATE ' . EMAIL_TEMPLATE_TABLE . ' SET isactive=1 WHERE tpl_id IN (' . implode(',', db_input($_POST['ids'])) . ')'; if (db_query($sql) && ($num = db_affected_rows())) { if ($num == $count) {
<?php require_once './global.php'; require_once './helpers/unsecure.php'; echo Template::create("credentials_forgotten_request");
case 'add': break; case 'edit': break; case 'delete': break; case 'search': break; default: } break; case 'statuses': switch ($act) { case 'add': break; case 'edit': break; case 'delete': break; case 'search': break; default: } break; default: } } else { $content = new Template('templates/admin/dashboard.html'); $body->add_key('content', $content->create()); } echo $body->create();