本文整理汇总了PHP中Template::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::get方法的具体用法?PHP Template::get怎么用?PHP Template::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGet
/**
* @covers Template::get
*/
public function testGet()
{
$key = "class";
$value = "errorCall";
$this->object->set($key, $value);
$this->assertSame($value, $this->object->get($key));
}
示例2: output
public static function output($vars = '')
{
// variables
$template = new Template($vars);
$cache = null;
$id = "{$_SERVER['HTTP_HOST']}/html/" . $template->hash;
// get available cache (if applicable)
if ($template->canCache()) {
// first thing, check if there's a cached version of the template
$cache = self::getCache($id);
}
//$cache = false;
if (!empty($cache) && !DEBUG) {
echo $cache;
return;
}
// continue processing
$template->setupClient();
//
$GLOBALS['body'] = $template->vars["body"];
$GLOBALS['head'] = $template->get("head");
$GLOBALS['foot'] = $template->get("foot");
// compile the page with the existing data
$output = $template->do_fetch($template->file, $template->vars);
// post-process (in debug with limited features)
$output = $template->process($output);
// output the final markup - clear whitespace (if not in debug mode)
echo $output;
// set the cache for later use
self::setCache($id, $output);
}
示例3: jkbanners_display_banners
function jkbanners_display_banners($atts)
{
$a = shortcode_atts(array('id' => false, 'filter_menu_order' => false, 'template' => 'list'), $atts);
$output = array();
//
$banners = array();
$banners = Banner::getAll();
if ($a['filter_menu_order']) {
foreach ($banners as $bk => $banner) {
if ($banner->post->menu_order != $a['filter_menu_order']) {
unset($banners[$bk]);
}
}
}
//
$bannerTemplate = new Template();
//One random banner
if ($a['template'] == 'random-single') {
//get a random item
$banner = $banners[array_rand($banners)];
//show single banner
$bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/single.php', array('banner' => $banner));
$output[] = $bannerTemplateResponse;
}
//List all banners
if ($a['template'] == 'list') {
$bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/list.php', array('banners' => $banners));
$output[] = $bannerTemplateResponse;
}
//
$output = implode("\n", $output);
return $output;
}
示例4: __construct
public function __construct($esxman, $database, $username = '', $error = null)
{
$this->esxman = $esxman;
$this->database = $database;
$this->username = $username;
$this->html = array('footer' => ' ', 'menu' => ' ', 'tree' => ' ', 'user' => ' ', 'content' => ' ');
$this->commands = array();
$this->title = _('Login');
if (request('form_name') == 'login') {
if ($this->database->authenticate_user(request('username'), request('password'))) {
session_destroy();
session_start();
$_SESSION['username'] = request('username');
$_SESSION['key'] = md5($_SESSION['username'] . getenv('REMOTE_ADDR') . getenv('X-FORWARDED-FOR'));
debug('User ' . request('username') . ' logging in!');
$this->commands[] = "\$('#dialog').html('" . _('Populating inventory...') . "');";
$this->commands[] = js_command('get', 'action=populate_inventory');
return;
}
$error = _('Authentication failed');
}
$tpl = new Template('dialog_login.html');
if ($error) {
$tpl->setVar('error', $error);
$tpl->parse('error_message');
}
$this->commands[] = js_command('display_dialog', _('Login'), $tpl->get(), _('Login'));
}
示例5: index
/**
* Displays a list of tables in the database.
*/
public function index()
{
$hide_form = false;
// Are we performing an action?
if (isset($_POST['action'])) {
// Checked the checked() variable
$_POST['checked'] = isset($_POST['checked']) ? $_POST['checked'] : '';
switch (strtolower($_POST['action'])) {
case strtolower(lang('db_backup')):
$hide_form = $this->backup($_POST['checked']);
break;
case strtolower(lang('db_repair')):
$this->repair($_POST['checked']);
break;
case strtolower(lang('db_optimize')):
$this->optimize();
break;
case strtolower(lang('db_drop')):
$hide_form = $this->drop($_POST['checked']);
break;
}
}
if (!$hide_form) {
$this->load->helper('number');
Template::set('tables', $this->db->query('SHOW TABLE STATUS')->result());
}
if (!Template::get('toolbar_title')) {
Template::set('toolbar_title', lang('db_database_maintenance'));
}
Template::render();
}
示例6: render
public function render()
{
$asset = Assets::get();
$this->addData(['css' => $asset->Css(), 'js' => $asset->Js(), 'internalCss' => $asset->InternalCss(), 'jsReady' => $asset->OnLoadJs()]);
$tpl = Template::get()->loadTemplate($this->template);
return $tpl->render($this->data);
}
示例7: form
public static function form(\Request $request, $command = null)
{
javascript('jquery');
\Form::requiredScript();
if (empty($command)) {
$command = 'run_search';
}
$system_locations = \systemsinventory\Factory\SystemDevice::getSystemLocations();
$location_options = '<option value="0">All</opton>';
foreach ($system_locations as $val) {
$location_options .= '<option value="' . $val['id'] . '">' . $val['display_name'] . '</option>';
}
$vars['locations'] = $location_options;
$system_types = \systemsinventory\Factory\SystemDevice::getSystemTypes();
$type_options = '<option value="0">All</opton>';
foreach ($system_types as $val) {
$type_options .= '<option value="' . $val['id'] . '">' . $val['description'] . '</option>';
}
$vars['system_types'] = $type_options;
$system_dep = \systemsinventory\Factory\SystemDevice::getSystemDepartments();
$dep_optons = '<option value="0">All</opton>';
foreach ($system_dep as $val) {
$dep_optons .= '<option value="' . $val['id'] . '">' . $val['display_name'] . '</option>';
}
$vars['departments'] = $dep_optons;
$vars['form_action'] = "./systemsinventory/search/" . $command;
$template = new \Template($vars);
$template->setModuleTemplate('systemsinventory', 'Search_System.html');
return $template->get();
}
示例8: respuestaConsulta
public function respuestaConsulta($array)
{
$obj = (object) $array;
$usuario = Usuario::getById($obj->user_id);
$template = new Template('consulta-response', array('asunto' => $obj->asunto, 'nombre' => $obj->nombre, 'apellido' => $obj->apellido, 'mensaje' => $obj->mensaje, 'fecha' => date('d/m/Y')));
$this->Body = $template->get();
$this->send();
}
示例9: track
/**
* Validate an Address to UPS AddressValidation API
*
* @access public
* @param string $tracking_number
* @return array $response
*/
public function track($tracking_number)
{
$template = Template::get();
$template->assign('tracking_number', $tracking_number);
$xml = $template->render('call/track.twig');
$result = $this->call('Track', $xml);
return $result;
}
示例10: index
/**
* function index
*
* list form data
*/
function index()
{
Template::set('records', $this->permission_model->find_all());
if (!Template::get("toolbar_title")) {
Template::set("toolbar_title", lang("permissions_manage"));
}
Template::render();
}
示例11: respuestaConsulta
public function respuestaConsulta($array)
{
$obj = (object) $array;
$usuario = Auth::UserAdmin();
$template = new Template('consulta-response', array('asunto' => $obj->asunto, 'nombre' => $obj->nombre, 'apellido' => $obj->apellido, 'mensaje' => $obj->mensaje));
$this->Body = $template->get();
$this->send();
}
示例12: contactLogin
private function contactLogin()
{
$vars = array();
$form = self::contactForm();
$vars = $form->getTemplate();
$template = new \Template($vars);
$template->setModuleTemplate('properties', 'contact_login.html');
\Layout::add($template->get());
}
示例13: Error_505
public static function Error_505($msg)
{
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 3600');
$tpl = Template::get()->loadTemplate('error_page.tpl');
echo $tpl->render(['message' => $msg]);
exit;
}
示例14: index
/**
* function index
*
* list form data
*/
function index()
{
Assets::add_js($this->load->view('settings/js', null, true), 'inline');
Template::set('records', $this->permission_model->order_by('name')->find_all());
Template::set('permission_header', '');
if (!Template::get("toolbar_title")) {
Template::set("toolbar_title", lang("permissions_manage"));
}
Template::render();
}
示例15: validate
/**
* Validate an Address to UPS AddressValidation API
*
* @access public
* @param \Tigron\Ups\Address $address
* @return array $response
*/
public function validate(Address $address)
{
$template = Template::get();
$template('zipcode', $address->zipcode);
$template('city', $address->city);
$template('country', $address->country);
$xml = $template->render('call/AddressValidationRequest.twig');
$result = $this->call('AV', $xml);
return $result;
}