本文整理汇总了PHP中Template::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::instance方法的具体用法?PHP Template::instance怎么用?PHP Template::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
示例2: error
function error($f3)
{
$log = new Log('error.log');
$log->write($f3->get('ERROR.text'));
foreach ($f3->get('ERROR.trace') as $frame) {
if (isset($frame['file'])) {
// Parse each backtrace stack frame
$line = '';
$addr = $f3->fixslashes($frame['file']) . ':' . $frame['line'];
if (isset($frame['class'])) {
$line .= $frame['class'] . $frame['type'];
}
if (isset($frame['function'])) {
$line .= $frame['function'];
if (!preg_match('/{.+}/', $frame['function'])) {
$line .= '(';
if (isset($frame['args']) && $frame['args']) {
$line .= $f3->csv($frame['args']);
}
$line .= ')';
}
}
// Write to custom log
$log->write($addr . ' ' . $line);
}
}
Template::instance()->render('error.html');
}
示例3: post
public function post()
{
$f3 = \Base::instance();
// $f3->reroute('/beta');
// Exit immediately if public registrations are disabled
if (!DbConfig::getOpt('openRegister')) {
$f3->error(400);
return;
}
if ($f3->get('POST.register-password') != $f3->get('POST.register-password-verify')) {
$f3->set('errors', ['Password verify must match the first password.']);
} else {
$user = User::createUser(array('name' => $f3->get("POST.register-name"), 'username' => $f3->get("POST.register-username"), 'email' => $f3->get("POST.register-email"), 'password' => $f3->get("POST.register-password")));
// Data missing
if ($user == false) {
$f3->set('errors', ['Some information has not been entered correctly or is not long enough.']);
} elseif (is_array($user)) {
$f3->set('errors', $user);
} else {
$f3->set('SESSION.id', $user->id);
$f3->set('tplData', ['name' => $f3->get("POST.register-username")]);
SendingAPI::send(['mailTo' => $f3->get("POST.register-email"), 'mailSubject' => 'Thank you for registering on SquareMS !', 'mailContents' => ['html' => \Template::instance()->render('mails/register.html'), 'text' => "Thank you for registering on SquareMS ! \n" . "You can access your account now on https://squarems.net/ ! \n\n" . "Please do not respond to this email, it is sent by an automated system."]]);
$f3->reroute("/dashboard");
return;
}
}
$f3->set('css', array('/static/css/auth.css'));
$f3->set('target', 'auth/register.html');
$this->_render('base.html');
}
示例4: getInstance
static function getInstance()
{
if (!Template::$instance) {
Template::$instance = new Template();
}
return Template::$instance;
}
示例5: license
function license()
{
$this->view->set('title', 'License');
$out = Template::instance()->render('basic/sub_license.html');
$this->view->set('sub_out_put', $out);
echo Template::instance()->render('basic/main.html');
}
示例6: afterroute
public function afterroute($f3)
{
// js view (file)
$f3->set('jsView', 'setup');
// render view
echo \Template::instance()->render($f3->get('PATHFINDER.VIEW.INDEX'));
}
示例7: getInstance
public static function getInstance($path = '')
{
if (!isset(self::$instance)) {
self::$instance = new Template($path);
}
return self::$instance;
}
示例8: index
public function index(\Base $f3, $params)
{
$this->response->addTitle($f3->get('LN__AdminMenu_Home'));
$f3->set('title_h1', $f3->get('LN__AdminMenu_Home'));
switch ($this->moduleInit(@$params['module'])) {
case "manual":
$this->buffer(\View\Base::stub());
break;
case "custompages":
$this->custompages($f3, $params);
break;
case "news":
$this->news($f3, $params);
break;
case "modules":
$this->buffer(\View\Base::stub());
break;
case "shoutbox":
$this->shoutbox($f3, $params);
break;
case "home":
$this->home($f3);
break;
default:
$this->buffer(\Template::instance()->render('access.html'));
}
}
示例9: index
public function index(\Base $f3, $params)
{
$this->response->addTitle($f3->get('LN__AdminMenu_Members'));
switch ($this->moduleInit(@$params['module'])) {
case "search":
$this->buffer(\View\Base::stub());
break;
case "pending":
$this->buffer(\View\Base::stub());
break;
case "groups":
$this->buffer(\View\Base::stub());
break;
case "profile":
$this->profile($f3, $params);
break;
case "team":
$this->team($f3);
break;
case "home":
$this->home($f3);
break;
default:
$this->buffer(\Template::instance()->render('access.html'));
}
}
示例10: upcoming
public function upcoming()
{
$upcoming = new Upcoming($this->db);
$this->f3->set('decks', $upcoming->all());
$this->f3->set('content', 'app/views/cards-upcoming.htm');
echo Template::instance()->render('app/templates/default.htm');
}
示例11: libraryBookFavMenu
public static function libraryBookFavMenu(array $menu, array $counter, $sub)
{
\Base::instance()->set('menu_upper', $menu);
\Base::instance()->set('counter', $counter);
\Base::instance()->set('sub', $sub);
return \Template::instance()->render('usercp/menu_upper.html');
}
示例12: htmlResponse
function htmlResponse($title, $html)
{
$f3 = Base::instance();
$f3->set('title', $title);
$f3->set('view', $html);
echo Template::instance()->render("layout.html");
}
示例13: Get
function Get($f3)
{
$f3->set('PHP', version_compare(PHP_VERSION, "5.3.4", "<"));
$f3->set('message', $f3->get('SESSION.flash'));
$f3->clear('SESSION.flash');
echo Template::instance()->render('install.html');
}
示例14: index
function index($f3)
{
if ($f3->exists("GET.sesi_lenyap")) {
\Flash::instance()->addMessage('Yoo bang! Selamat jalan~', 'success');
}
echo \Template::instance()->render("admin/auth/login.php");
}
示例15: scriptUpload
function scriptUpload($f3)
{
$this->ensureAdmin($f3);
$db = $f3->get('db');
Logger::Info($f3, "AdminPost.scriptUpload", "Starting import...");
$dummy = $f3->get('FILES');
$uploadedFile = $dummy["sqlFile"];
if ($uploadedFile["error"] > 0) {
Logger::Error($f3, "AdminPost.scriptUpload", $uploadedFile["error"]);
echo "Error: " . $uploadedFile["error"] . "<br>";
} else {
try {
$db->beginTransaction();
$importFileName = $f3->get('ROOT') . '/imports/import_' . date('Y-m-d_H\\hi\\m') . '.xlsx';
copy($uploadedFile["tmp_name"], $importFileName);
Logger::Info($f3, "AdminPost.scriptUpload", "Import file: " . $importFileName);
$importResult = ExcelImportExport::importFromExcel2007($db, $uploadedFile["tmp_name"]);
$db->commit();
$f3->set('scriptResult', $importResult);
Logger::Info($f3, "AdminPost.scriptUpload", "Import finished");
} catch (Exception $e) {
$db->rollBack();
$err = ExcelImportExport::$lastExecutedStatement . ' :: ' . $e->getMessage();
Logger::Error($f3, "AdminPost.scriptUpload", "Import failed: " . $err);
$f3->set('scriptResult', $err);
}
echo Template::instance()->render('adminIndex.htm');
}
}