本文整理汇总了PHP中get_tpl函数的典型用法代码示例。如果您正苦于以下问题:PHP get_tpl函数的具体用法?PHP get_tpl怎么用?PHP get_tpl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_tpl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: details
function details()
{
global $smarty;
$item = new dogma($this->typeID);
if (!$item->isValid()) {
$this->page->setTitle('Error');
return 'This ID is not a valid dogma ID.';
}
$this->page->setTitle('Item details - ' . $item->get('typeName'));
$this->page->addHeader('<meta name="robots" content="noindex, nofollow" />');
$smarty->assignByRef('item', $item);
if ($item->get('itt_cat') == 6) {
//we have a ship, so get it from the db
$ship = Ship::getByID($item->get('typeID'));
$smarty->assign('shipImage', $ship->getImage(64));
$smarty->assign('armour', array('armorHP', 'armorEmDamageResonance', 'armorExplosiveDamageResonance', 'armorKineticDamageResonance', 'armorThermalDamageResonance'));
$smarty->assign('shield', array('shieldCapacity', 'shieldRechargeRate', 'shieldEmDamageResonance', 'shieldExplosiveDamageResonance', 'shieldKineticDamageResonance', 'shieldThermalDamageResonance'));
$smarty->assign('propulsion', array('maxVelocity', 'agility', 'droneCapacity', 'capacitorCapacity', 'rechargeRate'));
$smarty->assign('fitting', array('hiSlots', 'medSlots', 'lowSlots', 'rigSlots', 'upgradeCapacity', 'droneBandwidth', 'launcherSlotsLeft', 'turretSlotsLeft', 'powerOutput', 'cpuOutput'));
$smarty->assign('targetting', array('maxTargetRange', 'scanResolution', 'maxLockedTargets', 'scanRadarStrength', 'scanLadarStrength', 'scanMagnetometricStrength', 'scanGravimetricStrength', 'signatureRadius'));
$smarty->assign('miscellaneous', array('techLevel', 'propulsionFusionStrength', 'propulsionIonStrength', 'propulsionMagpulseStrength', 'propulsionPlasmaStrength'));
$html = $smarty->fetch(get_tpl('invtype_ship'));
} else {
$i = new Item($this->typeID);
$smarty->assign('itemImage', $i->getIcon(64, false));
$smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
$html = $smarty->fetch(get_tpl('invtype_item'));
}
return $html;
}
示例2: generate
function generate()
{
global $smarty;
if (!$this->split_ || $this->max_ / $this->split_ <= 1) {
return;
}
$endpage = ceil($this->max_ / $this->split_);
$args = edkURI::parseURI();
if ($page = edkURI::getArg('page')) {
if (edkURI::getArg('page')) {
foreach ($args as $key => $value) {
if ($value[0] == 'page') {
unset($args[$key]);
break;
}
}
}
} else {
$page = 1;
}
$url = edkURI::build($args);
if (strpos($url, '?') === false) {
$url .= "?";
} else {
$url .= "&";
}
$smarty->assign('splitter_endpage', $endpage);
$smarty->assign('splitter_page', $page);
$smarty->assign('splitter_url', $url);
return $smarty->fetch(get_tpl('pagesplitter'));
}
示例3: use_keh
function use_keh()
{
// получаем имя файла
//$_name_file_keh=get_name_file_keh();
$_name_file_keh = parse_for_url(get_post_session()) . ".keh";
// debug ceche
if (DEBUG_KEH == 1) {
echo " Начало - " . $_name_file_keh;
}
// ищем сгенеренный кеш
if (file_exists(HOST . '/cache/' . $_GET['action'] . '/' . $_name_file_keh)) {
//echo "keh!!!";
$_str .= get_tpl('/cache/' . $_GET['action'] . '/' . $_name_file_keh);
// выводим содержимое
/*
* парсим банер
*/
// елементы для замены
$mass_element_for_parsing = array("%banner%");
$mass_result_for_parsing = array(_BANNER);
// парсим данные
$_str = parsing_data($mass_element_for_parsing, $mass_result_for_parsing, $_str);
// debug ceche
if (DEBUG_KEH == 1) {
echo " | keh!!!";
}
die($_str);
} else {
// debug ceche
if (DEBUG_KEH == 1) {
echo " | NO keh!!!";
}
}
}
示例4: run_template
function run_template($request, $page)
{
$tpl_main = get_tpl('main');
$tpl = $page['type'] == 'event' ? 'event' : 'info';
$tpl_page = get_tpl($tpl);
/*--- globals ---*/
$translate = array('[title]' => TITLE, '[base_url]' => BASE_URL, '{title}' => $page['title']);
$tpl_main = translate_tpl($tpl_main, $translate);
/*--- page ---*/
$translate = array('{event_join}' => $page['event_join'], '{event_people}' => $page['event_people'], '{event_author}' => $page['author'], '{after_text}' => $page['after_text']);
$tpl_page = translate_tpl($tpl_page, $translate);
$translate = array('{title}' => $page['title'], '{text}' => $page['text']);
$tpl_page = translate_tpl($tpl_page, $translate, true);
/*--- place page in main ---*/
$translate = array('@before_page' => $page['before_text'], '@page' => $tpl_page, '@after_page' => $page['after_text']);
$html = translate_tpl($tpl_main, $translate);
/*--- save html as cache ---*/
if (CACHE && !isset($page['no_cache'])) {
$cachefile = './pages/' . $request . '.html';
if (file_exists($cachefile) == false) {
file_put_contents($cachefile, $html);
}
}
return $html;
}
示例5: is_cached
protected function is_cached($tpl = null)
{
if (C("SMARTY_ON")) {
halt("请先开启smarty");
}
$tpl = $this - get_tpl($tpl);
return self::$smarty->is_cached($tpl, $_SERVER['REQUEST_URI']);
}
示例6: display_flashes
function display_flashes(&$flash)
{
foreach ($flash as $k => $v) {
if ($v) {
get_tpl('_flash', array('status' => $k, 'messages' => $v));
$flash[$k] = array();
}
}
}
示例7: generate
/**
* Generate the html from the template.
*
* @global Smarty $smarty
* @return string
*/
function generate()
{
global $smarty;
$smarty->assign('count', count($this->box_array));
if ($this->icon_) {
$smarty->assign('icon', config::get('cfg_img') . "/" . $this->icon_);
}
$smarty->assign('title', $this->title_);
$smarty->assign('items', $this->box_array);
return $smarty->fetch(get_tpl('box'));
}
示例8: generate
function generate()
{
global $smarty;
$this->toplist->generate();
while ($row = $this->toplist->getRow()) {
$item = new Item($row['itm_id']);
$rows[] = array('rank' => false, 'name' => $item->getName(), 'uri' => edkURI::build(array('a', 'invtype', true), array('id', $item->getID(), true)), 'icon' => $item->getIcon(32), 'count' => $row['cnt']);
}
$smarty->assign('tl_name', Language::get('weapon'));
$smarty->assign('tl_type', Language::get('kills'));
$smarty->assignByRef('tl_rows', $rows);
return $smarty->fetch(get_tpl('toplisttable'));
}
示例9: getHtml
/**
* Retrieve formatted html comments for a kill.
*
* The kill id is set when the Comments object is constructed.
*
* @global Smarty $smarty
* @param boolean $commentsOnly
* @return string
*/
function getHtml($commentsOnly = false)
{
global $smarty;
if (empty($this->comments_)) {
$this->getComments();
}
$smarty->assignByRef('comments', $this->comments_);
$smarty->assign('norep', time() % 3700);
$smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
if ($commentsOnly) {
return $smarty->fetch(get_tpl('comments_comments'));
} else {
return $smarty->fetch(get_tpl('block_comments'));
}
}
示例10: generate
function generate()
{
global $smarty;
$this->toplist->generate();
while ($row = $this->toplist->getRow()) {
$ship = Ship::getByID($row['shp_id']);
$shipclass = $ship->getClass();
$shipclass->getName();
$rows[] = array('rank' => false, 'name' => $ship->getName(), 'subname' => $shipclass->getName(), 'uri' => edkURI::page('invtype', $ship->getID()), 'portrait' => $ship->getImage(32), 'count' => $row['cnt']);
}
$smarty->assign('tl_name', Language::get('ship'));
$smarty->assign('tl_type', Language::get('kills'));
$smarty->assignByRef('tl_rows', $rows);
return $smarty->fetch(get_tpl('toplisttable'));
}
示例11: generate
/**
* Generate the HTML for this BarGraph.
*
* @global type $smarty
* @return string HTML for this bar.
*/
function generate()
{
if ($this->text == "") {
$this->text = " ";
}
if ($this->value) {
$width = (int) (100 * $this->value / $this->max);
} else {
$width = 0;
}
global $smarty;
$smarty->assign('class', $this->class);
$smarty->assign('width', $width);
$smarty->assign('text', $this->text);
return $smarty->fetch(get_tpl("bargraph"));
}
示例12: display
function display()
{
global $smarty;
$alls = $corps = $pilots = false;
if (config::get('cfg_allianceid')) {
$alls = array();
foreach (config::get('cfg_allianceid') as $entity) {
$alliance = new Alliance($entity);
if ($alliance->getExternalID()) {
$url = edkURI::page('alliance_detail', $alliance->getExternalID(), 'all_ext_id');
} else {
$url = edkURI::page('alliance_detail', $alliance->getID(), 'all_id');
}
$alls[] = array('id' => $alliance->getID(), 'extid' => $alliance->getExternalID(), 'name' => $alliance->getName(), 'portrait' => $alliance->getPortraitURL(128), 'url' => $url);
}
}
if (config::get('cfg_corpid')) {
$corps = array();
foreach (config::get('cfg_corpid') as $entity) {
$corp = new Corporation($entity);
if ($corp->getExternalID()) {
$url = edkURI::page('corp_detail', $corp->getExternalID(), 'crp_ext_id');
} else {
$url = edkURI::page('corp_detail', $corp->getID(), 'crp_id');
}
$corps[] = array('id' => $corp->getID(), 'extid' => $corp->getExternalID(), 'name' => $corp->getName(), 'portrait' => $corp->getPortraitURL(128), 'url' => $url);
}
}
if (config::get('cfg_pilotid')) {
$pilots = array();
foreach (config::get('cfg_pilotid') as $entity) {
$pilot = new Pilot($entity);
if ($pilot->getExternalID()) {
$url = edkURI::page('pilot_detail', $pilot->getExternalID(), 'plt_ext_id');
} else {
$url = edkURI::page('pilot_detail', $pilot->getID(), 'plt_id');
}
$pilots[] = array('id' => $pilot->getID(), 'extid' => $pilot->getExternalID(), 'name' => $pilot->getName(), 'portrait' => $pilot->getPortraitURL(128), 'url' => $url);
}
}
$smarty->assignByRef('alliances', $alls);
$smarty->assignByRef('corps', $corps);
$smarty->assignByRef('pilots', $pilots);
return $smarty->fetch(get_tpl('self'));
}
示例13: parsing_tpl
function parsing_tpl($name_file, $mass_element_for_parsing, $mass_result_for_parsing, $_str_ = "")
{
if (count($mass_element_for_parsing) > 0) {
// открываем файл tpl, считывем, парсим и выводим
$filename = HOST . "" . $name_file;
// echo $filename."<br><br>";
$fp = fopen($filename, 'r');
$output = fread($fp, filesize($filename));
fclose($fp);
for ($i = 0; $i < count($mass_element_for_parsing); $i++) {
// парсим
@($output = replace_data($output, $mass_element_for_parsing[$i], $mass_result_for_parsing[$i]));
}
} else {
$output = get_tpl($name_file);
}
return $_str_ . "" . $output;
}
示例14: generate
/**
* Generate the output html from the template file.
*/
function generate()
{
global $smarty;
$rows = array();
$max = 0;
for ($i = 1; $i <= $this->length_; $i++) {
$row = $this->toplist_->getRow();
if ($row) {
$rows[] = $row;
}
if ($row['cnt'] > $max) {
$max = $row['cnt'];
}
}
if (empty($rows)) {
return;
}
$pilot = new Pilot($rows[0]['plt_id']);
$smarty->assign('title', $this->title_);
$smarty->assign('pilot_portrait', $pilot->getPortraitURL(64));
$smarty->assign('award_img', config::get('cfg_img') . "/awards/" . $this->award_ . ".png");
$smarty->assign('url', edkURI::build(array('a', 'pilot_detail', true), array('plt_id', $rows[0]['plt_id'], true)));
$smarty->assign('name', $pilot->getName());
$bar = new BarGraph($rows[0]['cnt'], $max);
$smarty->assign('bar', $bar->generate());
$smarty->assign('cnt', $rows[0]['cnt']);
for ($i = 2; $i < $this->length_ + 1; $i++) {
if (!$rows[$i - 1]['plt_id']) {
break;
} else {
if (!$rows[$i - 1]['plt_name']) {
$pilot = new Pilot($rows[$i - 1]['plt_id']);
$pilotname = $pilot->getName();
} else {
$pilotname = $rows[$i - 1]['plt_name'];
}
}
$bar = new BarGraph($rows[$i - 1]['cnt'], $max);
$top[$i] = array('url' => edkURI::build(array('a', 'pilot_detail', true), array('plt_id', $rows[$i - 1]['plt_id'], true)), 'name' => $pilotname, 'bar' => $bar->generate(), 'cnt' => $rows[$i - 1]['cnt']);
}
$smarty->assign('top', $top);
$smarty->assign('comment', $this->comment_);
return $smarty->fetch(get_tpl('award_box'));
}
示例15: content
function content()
{
global $smarty;
if (trim($_POST['usrpass'])) {
if ($_POST['usrlogin'] == '' && $_POST['usrpass'] == ADMIN_PASSWORD && substr(ADMIN_PASSWORD, 0, 3) != '$1$' && substr(ADMIN_PASSWORD, 0, 3) != '$2$' && substr(ADMIN_PASSWORD, 0, 3) != '$2a$') {
@chmod("kbconfig.php", 0660);
if (!is_writeable("kbconfig.php")) {
$smarty->assign('error', 'Admin password is unencrypted and ' . 'kbconfig.php is not writeable. Either encrypt the admin ' . 'password or set kbconfig.php writeable.');
} else {
$kbconfig = file_get_contents('kbconfig.php');
$newpwd = preg_replace('/(\\$|\\\\)/', '\\\\$1', crypt(ADMIN_PASSWORD));
$kbconfig = preg_replace('/define\\s*\\(\\s*[\'"]ADMIN_PASSWORD[\'"]' . '[^)]*\\)/', "define('ADMIN_PASSWORD', '" . $newpwd . "')", $kbconfig);
file_put_contents("kbconfig.php", trim($kbconfig));
chmod("kbconfig.php", 0440);
session::create(true);
session_write_close();
header('Location: ' . htmlspecialchars_decode(edkURI::page('admin') . '&akey=' . session::makeKey()));
//session created but not in current page
die;
}
} else {
if ($_POST['usrlogin'] == '' && crypt($_POST['usrpass'], ADMIN_PASSWORD) == ADMIN_PASSWORD) {
session::create(true);
$page = preg_replace('/[^a-zA-Z0-9-_]/', '', edkURI::getArg("page", 1));
$page = $page ? $page : "admin";
header('Location: ' . htmlspecialchars_decode(edkURI::page('admin') . '&akey=' . session::makeKey()));
//session created but not in current page
session_write_close();
die;
} else {
$result = user::login($_POST['usrlogin'], $_POST['usrpass']);
if ($result) {
header('Location: ' . html_entity_decode(edkURI::page('home')));
die;
} else {
$smarty->assign('error', 'Login error, please check your username and password.');
}
}
}
}
return $smarty->fetch(get_tpl('user_login'));
}