本文整理汇总了PHP中XTemplate类的典型用法代码示例。如果您正苦于以下问题:PHP XTemplate类的具体用法?PHP XTemplate怎么用?PHP XTemplate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XTemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nv_theme_event_detail
/**
* nv_theme_event_detail()
*
* @param mixed $array_data
* @return
*/
function nv_theme_event_detail($array_data)
{
global $global_config, $module_name, $module_file, $lang_module, $module_config, $module_info, $op, $global_array_event_cat;
if (NV_CURRENTTIME >= $array_data['start_time'] and NV_CURRENTTIME <= $array_data['end_time']) {
$array_data['status_str'] = $lang_module['status_2'];
} elseif (NV_CURRENTTIME < $array_data['start_time']) {
$array_data['status_str'] = $lang_module['status_1'];
} else {
$array_data['status_str'] = $lang_module['status_0'];
}
$array_data['start_date'] = nv_date('d/m/Y', $array_data['start_time']);
$array_data['start_time'] = nv_date('H:i', $array_data['start_time']);
$array_data['end_date'] = nv_date('d/m/Y', $array_data['end_time']);
$array_data['end_time'] = nv_date('H:i', $array_data['end_time']);
$array_data['title_cat'] = $global_array_event_cat[$array_data['catid']]['title'];
$array_data['url_cat'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_event_cat[$array_data['catid']]['alias'];
$xtpl = new XTemplate($op . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('DATA', $array_data);
if ($array_data['start_date'] == $array_data['end_date']) {
$xtpl->parse('main.day');
} else {
$xtpl->parse('main.longday');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
示例2: nv_block_video
function nv_block_video()
{
global $global_config, $site_mods, $db, $module_name;
$rVid = 1;
$get_video_query = "SELECT * FROM `nv_vi_video_picture` WHERE `pictureid`={$rVid}";
if (($query = $db->sql_query($get_video_query)) !== false) {
if (($row = $db->sql_fetchrow($query)) !== false) {
$rs = $row;
}
}
if (!empty($rs['path']) and file_exists(NV_UPLOADS_REAL_DIR . "/" . "video" . $rs['path'])) {
$rs['path'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . "video" . $rs['path'];
}
if (!empty($rs['vpath']) and file_exists(NV_UPLOADS_REAL_DIR . "/" . "video" . $rs['vpath'])) {
$rs['vpath'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . "video" . $rs['vpath'];
}
$block_theme = "default";
$xtpl = new XTemplate("global.video.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/blocks");
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$xtpl->assign('URL_PP', $rs['path']);
$xtpl->assign('URL_V', $rs['vpath']);
$xtpl->assign('VID_NAME', $rs['name']);
$xtpl->assign('VID_DES', $rs['description']);
$xtpl->assign('NUM_VVIEW', $rs['num_view']);
$xtpl->assign('IMGP', NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/" . $module_name . "/");
$xtpl->parse('main');
return $xtpl->text('main');
}
示例3: getEditor
function getEditor()
{
$xtpl = new XTemplate(dirname(__FILE__) . '/editor.xtpl');
$xtpl->parse('main.menu_item_list');
$xtpl->parse('main');
return $xtpl->text('main');
}
示例4: main_theme
/**
* main_theme()
*
* @param mixed $contents
* @return
*/
function main_theme($contents)
{
if (empty($contents)) {
return '';
}
global $global_config, $module_file;
$xtpl = new XTemplate('cronjobs_list.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
foreach ($contents as $id => $values) {
$xtpl->assign('DATA', array('caption' => $values['caption'], 'edit' => empty($values['edit']) ? array() : $values['edit'], 'disable' => empty($values['disable']) ? array() : $values['disable'], 'delete' => empty($values['delete']) ? array() : $values['delete'], 'id' => $id));
if (!empty($values['edit'][0])) {
$xtpl->parse('main.edit');
}
if (!empty($values['disable'][0])) {
$xtpl->parse('main.disable');
}
if (!empty($values['delete'][0])) {
$xtpl->parse('main.delete');
}
$a = 0;
foreach ($values['detail'] as $key => $value) {
$xtpl->assign('ROW', array('key' => $key, 'value' => $value));
$xtpl->parse('main.loop');
}
$xtpl->parse('main');
}
return $xtpl->text('main');
}
示例5: nv_page_list
/**
* nv_page_list()
*
* @return
*/
function nv_page_list($block_config)
{
global $global_config, $site_mods, $db, $module_name;
$module = $block_config['module'];
if (!isset($site_mods[$module])) {
return '';
}
$db->sqlreset()->select('id, title, alias')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'])->where('status = 1')->order('weight ASC')->limit($block_config['numrow']);
$list = nv_db_cache($db->sql(), 'id', $module);
if (!empty($list)) {
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/page/block.page_list.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/page/block.page_list.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block.page_list.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/page');
foreach ($list as $l) {
$l['title_clean60'] = nv_clean60($l['title'], $block_config['title_length']);
$l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $l['alias'] . $global_config['rewrite_exturl'];
$xtpl->assign('ROW', $l);
$xtpl->parse('main.loop');
}
$xtpl->parse('main');
return $xtpl->text('main');
} else {
return '';
}
}
示例6: nv_page_list
/**
* nv_page_list()
*
* @return
*/
function nv_page_list($block_config)
{
global $global_config, $site_mods, $db, $module_name;
$module = $block_config['module'];
if (!isset($site_mods[$module])) {
return '';
}
$db->sqlreset()->select('id, title, phone,phone1,image')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'])->where('status = 1')->order('weight ASC')->limit($block_config['numrow']);
$list = nv_db_cache($db->sql(), 'id', $module);
if (!empty($list)) {
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/nhan-vien/block.nhanvien.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/nhan-vien/block.nhanvien.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block.nhanvien.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/nhan-vien');
foreach ($list as $l) {
$l['img'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['image'];
$xtpl->assign('ROW', $l);
$xtpl->parse('main.loop');
}
$xtpl->parse('main');
return $xtpl->text('main');
} else {
return '';
}
}
示例7: execute
function execute()
{
if ($this->user['user_level'] < USER_ADMIN) {
return $this->error('Access Denied: You do not have permission to perform that action.');
}
$this->title('Banned IPs');
if (!isset($this->post['submit'])) {
$ips = null;
if (isset($this->settings['banned_ips'])) {
$ips = implode("\n", $this->settings['banned_ips']);
}
$xtpl = new XTemplate('./skins/' . $this->skin . '/AdminCP/ban.xtpl');
$xtpl->assign('token', $this->generate_token());
$xtpl->assign('ip_addresses', $ips);
$xtpl->parse('Bans');
return $xtpl->text('Bans');
}
if (!$this->is_valid_token()) {
return $this->error('Invalid or expired security token. Please go back, reload the form, and try again.');
}
$banned_ips = trim($this->post['banned_ips']);
if ($banned_ips) {
$banned_ips = explode("\n", $banned_ips);
} else {
$banned_ips = array();
}
$this->settings['banned_ips'] = $banned_ips;
$this->save_settings();
return $this->message('Banned IPs', 'Bans updated.', 'Continue', 'admin.php?a=ban');
}
示例8: nv_blog_news_tags
function nv_blog_news_tags($block_config)
{
global $site_mods, $module_array_cat, $global_config, $lang_module, $db, $module_config, $module_info;
$module = $block_config['module'];
$mod_data = $site_mods[$module]['module_data'];
$mod_file = $site_mods[$module]['module_file'];
$block_theme = nv_check_theme($mod_file);
$xtpl = new XTemplate('block.news_tags.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('TEMPLATE', $block_theme);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$excluded = $block_config['excluded'];
if (!empty($excluded)) {
$sql = 'SELECT tid, numnews, alias, keywords FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_tags WHERE tid NOT IN (' . $excluded . ') ORDER BY ' . $block_config['tagsort'] . ' ' . $block_config['tagsort_type'] . ' LIMIT 0, ' . $block_config['numrow'];
} else {
$sql = 'SELECT tid, numnews, alias, keywords FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_tags ORDER BY ' . $block_config['tagsort'] . ' ' . $block_config['tagsort_type'] . ' LIMIT 0, ' . $block_config['numrow'];
}
$list = $nv_Cache->db($sql, 'id', $module);
if (!empty($list)) {
foreach ($list as $l) {
$l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=tag/' . $l['alias'];
if (!empty($block_config['newslinks'])) {
$xtpl->assign('COUNT', $l['numnews']);
$xtpl->parse('main.loop.count_tags');
}
$xtpl->assign('LOOP', $l);
$xtpl->parse('main.loop');
}
}
$xtpl->parse('main');
return $xtpl->text('main');
}
示例9: cot_ukarma
function cot_ukarma($userid, $area = 'users', $code = '', $onlyscore = false)
{
global $db, $cfg, $db_ukarma, $db_users;
if ($area == 'users' && $db->fieldExists($db_users, "user_ukarma")) {
$score = $db->query("SELECT user_ukarma FROM {$db_users} WHERE user_id=" . $userid)->fetchColumn();
} else {
$where['ukarma_userid'] = "ukarma_userid=" . $userid;
if (!empty($area) && $area != 'users') {
$where['ukarma_area'] = "ukarma_area='" . $area . "'";
}
if (!empty($code)) {
$where['ukarma_code'] = "ukarma_code='" . $code . "'";
}
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$score = $db->query("SELECT SUM(ukarma_value) FROM {$db_ukarma} {$where}")->fetchColumn();
}
if ($onlyscore) {
return !empty($score) ? $score : 0;
}
if ($score > 0) {
$sign = '+';
} elseif ($score < 0) {
$sign = '-';
}
$t = new XTemplate(cot_tplfile(array('ukarma', $area), 'plug'));
$t->assign(cot_generate_usertags($userid, 'UKARMA_USER_'));
$t->assign(array('UKARMA_AREA' => $area, 'UKARMA_CODE' => $code, 'UKARMA_SELECTOR' => 'ukarma_' . $userid . $area . $code, 'UKARMA_SCOREENABLED' => cot_ukarma_checkenablescore($userid, $area, $code), 'UKARMA_SCORE' => !empty($score) ? $score : 0, 'UKARMA_SCORE_ABS' => !empty($score) ? abs($score) : 0, 'UKARMA_SIGN' => $sign));
$t->parse('MAIN');
return $t->text('MAIN');
}
示例10: nv_news_category
function nv_news_category($block_config)
{
global $module_array_cat, $module_info, $lang_module, $global_config;
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/news/block_category.tpl')) {
$block_theme = $global_config['module_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block_category.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/news');
if (!empty($module_array_cat)) {
$title_length = $block_config['title_length'];
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('BLOCK_ID', $block_config['bid']);
$xtpl->assign('TEMPLATE', $block_theme);
$html = '';
foreach ($module_array_cat as $cat) {
if ($block_config['catid'] == 0 && $cat['parentid'] == 0 || $block_config['catid'] > 0 && $cat['parentid'] == $block_config['catid']) {
$html .= "<li>\n";
$html .= "<a title=\"" . $cat['title'] . "\" href=\"" . $cat['link'] . "\">" . nv_clean60($cat['title'], $title_length) . "</a>\n";
if (!empty($cat['subcatid'])) {
$html .= "<span class=\"fa arrow expand\"></span>";
$html .= nv_news_sub_category($cat['subcatid'], $title_length);
}
$html .= "</li>\n";
}
}
$xtpl->assign('MENUID', $block_config['bid']);
$xtpl->assign('HTML_CONTENT', $html);
$xtpl->parse('main');
return $xtpl->text('main');
}
}
示例11: nv_page_main_list
/**
* nv_page_main_list()
*
* @param mixed $array_data
* @return
*/
function nv_page_main_list($array_data, $generate_page)
{
global $global_config, $module_file, $lang_global, $module_upload, $module_info, $module_name;
$template = file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file . '/main_list.tpl') ? $module_info['template'] : 'default';
$xtpl = new XTemplate('main_list.tpl', NV_ROOTDIR . '/themes/' . $template . '/modules/' . $module_file);
$xtpl->assign('GLANG', $lang_global);
if (!empty($array_data)) {
foreach ($array_data as $row) {
if (!empty($row['image'])) {
$row['image'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $row['image'];
$row['imagealt'] = !empty($row['imagealt']) ? $row['imagealt'] : $row['title'];
}
$xtpl->assign('DATA', $row);
if (!empty($row['image'])) {
$xtpl->parse('main.loop.image');
}
if (defined('NV_IS_MODADMIN')) {
$xtpl->assign('ADMIN_CHECKSS', md5($row['id'] . $global_config['sitekey'] . session_id()));
$xtpl->assign('ADMIN_EDIT', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=content&id=' . $row['id']);
$xtpl->parse('main.loop.adminlink');
}
$xtpl->parse('main.loop');
}
if ($generate_page != '') {
$xtpl->assign('GENERATE_PAGE', $generate_page);
}
}
$xtpl->parse('main');
return $xtpl->text('main');
}
示例12: process_page
/**
*
*/
function process_page()
{
global $theme;
global $mod_strings;
global $app_strings;
global $currentModule;
global $sugar_version, $sugar_config;
$output_html = '';
$where = '';
$where = $this->_get_where_clause();
$image_path = 'themes/' . $theme . '/images/';
$first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name'];
$last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_name'];
$user_name = empty($_REQUEST['user_name']) ? '' : $_REQUEST['user_name'];
$request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
$hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
if (!$hide_clear_button) {
$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n";
}
$button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n";
$button .= "</form>\n";
$form = new XTemplate('modules/Employees/Popup_picker.html');
$form->assign('MOD', $mod_strings);
$form->assign('APP', $app_strings);
$form->assign('THEME', $theme);
$form->assign('MODULE_NAME', $currentModule);
$form->assign('FIRST_NAME', $first_name);
$form->assign('LAST_NAME', $last_name);
$form->assign('USER_NAME', $user_name);
$form->assign('request_data', $request_data);
ob_start();
insert_popup_header($theme);
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
$form->parse('main.SearchHeader');
$output_html .= $form->text('main.SearchHeader');
$output_html .= get_form_footer();
// Reset the sections that are already in the page so that they do not print again later.
$form->reset('main.SearchHeader');
// create the listview
$seed_bean = new Employee();
$ListView = new ListView();
$ListView->show_export_button = false;
$ListView->process_for_popups = true;
$ListView->setXTemplate($form);
$ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
$ListView->setHeaderText($button);
$ListView->setQuery($where, '', 'user_name', 'EMPLOYEE');
$ListView->setModStrings($mod_strings);
ob_start();
$ListView->processListView($seed_bean, 'main', 'EMPLOYEE');
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_footer();
$output_html .= insert_popup_footer();
return $output_html;
}
示例13: nv_theme_crawler_search
/**
* nv_theme_crawler_search()
*
* @param mixed $array_data
* @return
*/
function nv_theme_crawler_search($array_data)
{
global $global_config, $module_name, $module_file, $lang_module, $module_config, $module_info, $op;
$xtpl = new XTemplate($op . ".tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->parse('main');
return $xtpl->text('main');
}
示例14: sendcontact
/**
* sendcontact()
*
* @param mixed $url
* @return
*/
function sendcontact($url)
{
global $module_file, $global_config, $module_info, $lang_module;
$xtpl = new XTemplate("sendcontact.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);
$lang_module['urlrefresh'] = $url;
$xtpl->assign('LANG', $lang_module);
$xtpl->parse('main');
return $xtpl->text('main');
}
示例15: sendcontact
/**
* sendcontact()
*
* @param mixed $url
* @return
*/
function sendcontact($url)
{
global $module_file, $module_info, $lang_module;
$xtpl = new XTemplate('sendcontact.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
$lang_module['urlrefresh'] = nv_url_rewrite($url, true);
$xtpl->assign('LANG', $lang_module);
$xtpl->parse('main');
return $xtpl->text('main');
}