本文整理汇总了PHP中Template::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::getInstance方法的具体用法?PHP Template::getInstance怎么用?PHP Template::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->url = URL::getInstance();
$this->template = Template::getInstance();
$this->request = Request::getInstance();
$this->values = Values::getInstance();
}
示例2: js
public function js()
{
$row = $this->input->getInt('row');
$col = $this->input->getInt('col');
$uid = $this->input->getInt('uid');
$count = $row * $col;
$sql = 'SELECT
ads.*
FROM ck_ads as ads
JOIN ck_packages as pack
ON(ads.package_id=pack.id)
WHERE
ads.status="approve" AND
ads.clicked < pack.max_click
ORDER BY RAND()
LIMIT ' . $count;
$query = $this->db->query($sql);
$tmpl = Template::getInstance('empty.tpl');
$tmpl->loadPage('jsAds');
fb($col, 'row');
for ($i = 0; $i < $row; ++$i) {
$tmp = array();
for ($j = 0; $j < $col; ++$j) {
$tmp[] = $query->fetch();
}
$data[] = $tmp;
}
fb($data);
$tmpl->assign('uid', $uid);
$tmpl->assign('row', $row);
$tmpl->assign('col', $col);
$tmpl->assign('data', $data);
Response::getInstance()->setTemplate($tmpl);
}
示例3: editAction
public function editAction()
{
//on charge le model de formation
$maFormationSession = App::getModel('FormationSession');
//crée la liste des matières via une collection
$collection = App::getCollection('Formation');
$collection->select();
$coll_for = $collection->getItems();
if (isset($_GET['id'])) {
$maFormationSession->load($_GET['id']);
}
if (isset($_POST['submit'])) {
//Si id existe et n'est pas vide, on modifie
if (isset($_POST['id']) && !empty($_POST['id'])) {
$maFormationSession->store(array('id' => $_POST['id']));
} else {
//sinon c'est une création
$maFormationSession->store(array('id' => 0));
}
$maFormationSession->store(array('begin_date' => $_POST['begin_date'], 'ending_date' => $_POST['ending_date'], 'formations_id' => $_POST['formations']));
//on appelle la méthode qui stock les infos dans l'objet crée
$maFormationSession->save();
//Formation et les réf pedago lié sont crée, on retoure au listing
header("Location: index.php?c=FormationSession");
}
//On transmet via setDatas() la collection de formation dans un tableau associatif
Template::getInstance()->setFileName("FormationSession/edit_formationsession")->setDatas(array('maFormationSession' => $maFormationSession, 'coll_for' => $coll_for))->render();
}
示例4: fetch
/**
+----------------------------------------------------------
* 渲染模板输出
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $templateFile 模板文件名
* @param array $var 模板变量
+----------------------------------------------------------
* @return void
+----------------------------------------------------------
*/
public function fetch($templateFile, $_var)
{
$template_dir = dirname($templateFile) . DIRECTORY_SEPARATOR;
vendor('TpcTemplate.template#class');
if (C('TMPL_ENGINE_CONFIG')) {
$config = C('TMPL_ENGINE_CONFIG');
$options = array();
foreach ($config as $key => $val) {
$options[$key] = $val;
}
unset($config);
} else {
$options = array('template_dir' => TMPL_PATH, 'cache_dir' => CACHE_PATH, 'auto_update' => true, 'cache_lifetime' => 0, 'suffix' => '.html');
}
if (is_dir($template_dir)) {
$options['template_dir'] = $template_dir;
}
$template = Template::getInstance();
//使用单件模式实例化模板类
$template->setOptions($options);
//设置模板参数
unset($template_dir);
extract($_var);
if (is_file($templateFile)) {
include $template->getfile(basename($templateFile, $options['suffix']));
} else {
include $template->getfile(basename($template_dir . $templateFile, $options['suffix']));
}
}
示例5: smarty_function_widget
/**
* This method will get a module/action or module template result
*
* @param array $params
* @param Smarty $smarty
*/
function smarty_function_widget($params, &$smarty)
{
if (!isset($params['module']) || !isset($params['action']) && !isset($params['template']) || isset($params['action']) && isset($params['template'])) {
throw new SmartyException('{widget} : module and action (or template) parameters must be defined');
}
$args = array();
if (count($params) > 2) {
foreach ($params as $k => $v) {
if ($k !== 'module' && $k !== 'action' && $k !== 'template') {
$args[$k] = $v;
}
}
}
if (isset($params['action'])) {
Controller::getInstance()->setModule($params['module'])->setAction($params['action'])->setArgs(array($args))->dispatch();
} else {
if ($file = get_module_file($params['module'], 'template/' . $params['template'], true)) {
$tpl = Template::getInstance($file);
foreach ($smarty->tpl_vars as $k => $v) {
if ($k !== 'SCRIPT_NAME' && $k !== 'smarty' && !isset($args[$k])) {
$args[$k] = $v->value;
}
}
if (empty($args)) {
return $tpl->get();
}
foreach ($args as $name => $value) {
$tpl->assign($name, $value);
}
return $tpl->get();
}
}
}
示例6: showBan
public function showBan()
{
Factory::getUser()->authorise("admin", ResponseRegistery::getInstance()->site_id);
$db = Factory::getDBO();
if ($search) {
$where = " AND blog.title LIKE '%{$search}%' or sub.sub_domain='{$search}' ";
}
$tmpl = Template::getInstance('adminDashboard.tpl');
$pg = $tmpl->initPagination();
$start = $pg->getCurrentIndex();
$limit = $pg->getLimit();
$sql = 'SELECT
blog.title as title,
sub.sub_domain,
blog.site_id,
max(post.`date`)as lastpost,
site.active as active
FROM wb_weblogs as blog
JOIN ge_sites as site
ON(blog.site_id=site.id)
JOIN ge_subdomains as sub
ON(sub.site_id=sub.site_id)
left JOIN wb_articles as post
ON(post.weblog_id=blog.id)
WHERE site.active=0
' . $where . '
group by blog.site_id
LIMIT ' . "{$start},{$limit}";
$list = $db->query($sql)->fetchAll();
$tmpl->loadPage('listblog');
$tmpl->assign('list', $list);
$this->reponse->setTitle('لیست وبلاگها');
$this->reponse->setTemplate($tmpl);
}
示例7: showSystemStatus
/**
*
* Systemstatus anzeigen
*
*/
public function showSystemStatus($ErrorString = "", $StatusString = "")
{
//if(!Controler_Main::getInstance()->isUserLoggedIn())//if( $this->User->getUserLevel() < BACKEND_USERLEVEL )
if (Controler_Main::getInstance()->getUserLevel() < BACKEND_USERLEVEL) {
$ControlerStart = new Controler_Start();
$ControlerStart->start();
return false;
}
$Request = new Request();
/*
$SystemInformationFinder= new SystemInformationFinder();
$MySql = $SystemInformationFinder->mysqlVersion();
$MySqlVersion = $MySql[0]['s_MySqlVersion'];
*/
$PHPVersion = phpversion();
$WebserverVersion = $_SERVER['SERVER_SOFTWARE'];
$WebserverVersion = "<div class='befehlskontainer' >" . str_replace(" ", "</div><div class='befehlskontainer' >", $WebserverVersion) . "</div>";
$WebserverConfig = "<div class='befehlskontainer' >:T_SERVER_NAME:: " . $_SERVER['SERVER_NAME'] . "</div><div class='befehlskontainer' >";
$WebserverConfig .= ":T_SERVER_ADDR:: " . $_SERVER['SERVER_ADDR'] . "</div><div class='befehlskontainer' >";
$WebserverConfig .= ":T_SERVER_PORT:: " . $_SERVER['SERVER_PORT'] . "</div><div class='befehlskontainer' >";
$WebserverConfig .= ":T_REMOTE_ADDR:: " . $_SERVER['REMOTE_ADDR'] . "</div><div class='befehlskontainer' >";
$WebserverConfig .= ":T_DOCUMENT_ROOT:: " . $_SERVER['DOCUMENT_ROOT'] . "</div><div class='befehlskontainer' >";
$WebserverConfig .= ":T_SERVER_ADMIN:: " . $_SERVER['SERVER_ADMIN'] . "</div>";
$Template = Template::getInstance("tpl_BE_SystemStatus.php");
$Template->assign("UserId", Controler_Main::getInstance()->getUser()->getId());
$Template->assign("WebserverConfig", $WebserverConfig);
$Template->assign("WebserverVersion", $WebserverVersion);
$Template->assign("PHPVersion", $PHPVersion);
$Template->assign("MySqlVersion", mysql_get_server_info());
$Template->assign("MySqlClientInfo", mysql_get_client_info());
$Template->assign("MySqlProtInfo", mysql_get_proto_info());
$Template->assign("MySqlHostInfo", mysql_get_host_info());
$Template->render();
}
示例8: __construct
function __construct($model_name, $method = 'post', $action = null)
{
$this->model_name = $model_name;
$this->method = $method;
$this->action = $action;
$this->schema = new Schema($model_name);
$this->template = Template::getInstance();
}
示例9: generate
public function generate()
{
if ($this->inline) {
return Template::getInstance()->get('form_panel_inline', $this->getData());
} else {
return Template::getInstance()->get('form_panel', $this->getData());
}
}
示例10: __construct
/**
* 架构函数
* @access public
*/
public function __construct()
{
$this->tagLib = strtolower(substr(get_class($this), 6));
$this->tpl = Template::getInstance();
//ThinkTemplate::getInstance();
$this->_initialize();
$this->load();
}
示例11: generate
public function generate()
{
$content = '';
foreach ($this->content as $menu) {
$content .= $menu->generate();
}
$data = array('__BLOCK__' => $content);
return Template::getInstance()->get('slide', $data, 'org.sygil.slide.block');
}
示例12: generate
public function generate()
{
$style = '';
if ($this->background) {
$style .= 'background:' . $this->background . ';';
}
$data = array('__ID__' => $this->id, '__CONTENT__' => $this->content, '__STYLE__' => $style);
return Template::getInstance()->get('line', $data, 'org.sygil.base.panel');
}
示例13: generate
public function generate()
{
$content = '';
foreach ($this->content as $menu) {
$content .= $menu->generate();
}
$data = array('__TITLE__' => $this->title, '__CONTENT__' => $content, '__STYLE__' => $this->active ? 'display:block;' : 'display:none;', '__ID__' => $this->id);
return Template::getInstance()->get('block', $data, 'org.sygil.menu.block');
}
示例14: aviators_templates_init
function aviators_templates_init()
{
$clear = aviators_settings_get_value('templates', 'cache', 'clear');
$debug = aviators_settings_get_value('templates', 'cache', 'debug');
if ($clear == 'on') {
$instance = Template::getInstance();
$instance->clearCacheFiles();
update_option('templates_cache_clear', FALSE);
}
}
示例15: showList
public function showList()
{
Factory::getUser()->authorise("template", ResponseRegistery::getInstance()->site_id);
$db = Factory::getDBO();
$list = $db->SimpleSelect("ge_default_templates", "id,image,name")->fetchAll();
$tmpl = Template::getInstance('userDashboard.tpl');
$tmpl->loadPage('list_template');
$tmpl->assign('list', $list);
$this->reponse->setTitle('لیست قالب ها');
$this->reponse->setTemplate($tmpl);
}