本文整理汇总了PHP中XTemplate::text方法的典型用法代码示例。如果您正苦于以下问题:PHP XTemplate::text方法的具体用法?PHP XTemplate::text怎么用?PHP XTemplate::text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XTemplate
的用法示例。
在下文中一共展示了XTemplate::text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mainAction
/**
* main action
*/
public function mainAction()
{
$template['file'] = ONXSHOP_DIR . "templates/{$this->GET['template']}";
$tpl = new XTemplate($template['file']);
$tpl->parse('title');
$tpl->parse('description');
$tpl->parse('keywords');
$tpl->parse('head');
$template['title'] = $tpl->text('title');
$template['description'] = $tpl->text('description');
$template['keywords'] = $tpl->text('keywords');
$template['head'] = $tpl->text('head');
if (file_exists($template['file'])) {
$file_content = file($template['file']);
foreach ($file_content as $file_line) {
$proc = 1;
if (preg_match('/<\\!-- BEGIN: content -->/', $file_line)) {
$add = 1;
$proc = 0;
} else {
if (preg_match('/<\\!-- END: content -->/', $file_line)) {
$add = 0;
}
}
if ($add == 1 && $proc == 1) {
$template['content'] = $template['content'] . $file_line;
}
}
} else {
msg("template {$template['file']} does not exists!", 'error', 1);
}
$this->tpl->assign('template', $template);
return true;
}
示例2: elseif
/**
* 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 '';
}
}
示例3: nv_show_sources_list
/**
* nv_show_sources_list()
*
* @return
*
*/
function nv_show_sources_list()
{
global $db, $lang_module, $lang_global, $module_name, $module_data, $nv_Request, $module_file, $global_config;
$num = $db->query('SELECT COUNT(*) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_sources')->fetchColumn();
$base_url = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_data . '&' . NV_OP_VARIABLE . '=sources';
$num_items = $num > 1 ? $num : 1;
$per_page = 15;
$page = $nv_Request->get_int('page', 'get', 1);
$xtpl = new XTemplate('sources_list.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
if ($num > 0) {
$db->sqlreset()->select('*')->from(NV_PREFIXLANG . '_' . $module_data . '_sources')->order('weight')->limit($per_page)->offset(($page - 1) * $per_page);
$result = $db->query($db->sql());
while ($row = $result->fetch()) {
$xtpl->assign('ROW', array('sourceid' => $row['sourceid'], 'title' => $row['title'], 'link' => $row['link'], 'url_edit' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=sources&sourceid=' . $row['sourceid'] . '#edit'));
for ($i = 1; $i <= $num; ++$i) {
$xtpl->assign('WEIGHT', array('key' => $i, 'title' => $i, 'selected' => $i == $row['weight'] ? ' selected="selected"' : ''));
$xtpl->parse('main.loop.weight');
}
$xtpl->parse('main.loop');
}
$result->closeCursor();
$generate_page = nv_generate_page($base_url, $num_items, $per_page, $page);
if (!empty($generate_page)) {
$xtpl->assign('GENERATE_PAGE', $generate_page);
$xtpl->parse('main.generate_page');
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
} else {
$contents = ' ';
}
return $contents;
}
示例4: gui_loi_cam_on_da_lien_he
function gui_loi_cam_on_da_lien_he($ten, $email, $chude, $noidung)
{
include_once 'xtemplate.class.php';
$header = 'Content-type: text/html; charset=utf-8\\r\\n';
$title = get_bloginfo('name');
$contact_email = get_option('contactemail');
$contact_name = get_bloginfo('name');
$date = date('d-m-Y');
$parseTemplate = new XTemplate('xtemplate.cam-on-da-lien-he.html');
$parseTemplate->assign('fullname', $ten);
$parseTemplate->assign('link', get_bloginfo('home'));
$parseTemplate->assign('website', get_bloginfo('name'));
$parseTemplate->assign('date', $date);
$parseTemplate->assign('email', $email);
$parseTemplate->assign('tieude', $chude);
$parseTemplate->assign('noidung', $noidung);
$parseTemplate->assign('contact_email', $contact_email);
$parseTemplate->assign('contact_name', $contact_name);
$parseTemplate->parse('main');
$mail = wp_mail($email, $title, $parseTemplate->text('main'), $title);
if ($mail) {
?>
<script>
alert ('Gửi mail thành công');
</script>
<?php
} else {
?>
<script>
alert ('Vui lòng thử lại');
</script>
<?php
}
}
示例5: 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');
}
示例6: XTemplate
function nv_news_category($block_config)
{
global $module_array_cat, $module_info, $lang_module;
$xtpl = new XTemplate("block_category.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/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', $module_info['template']);
$html = "";
foreach ($module_array_cat as $cat) {
if ($cat['parentid'] == 0) {
$html .= "<li>\n";
$html .= "<a title=\"" . $cat['title'] . "\" href=\"" . $cat['link'] . "\">" . nv_clean60($cat['title'], $title_length) . "</a>\n";
if (!empty($cat['subcatid'])) {
$html .= nv_news_sub_category($cat['subcatid'], $title_length);
}
$html .= "</li>\n";
}
}
$xtpl->assign('HTML_CONTENT', $html);
$xtpl->parse('main');
return $xtpl->text('main');
}
}
示例7: array
function nv_weather_blocks($block_config)
{
global $global_config, $site_mods, $db, $module_name;
$module = $block_config['module'];
$array_th = array();
$sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_weather WHERE status = 1 ORDER BY weight ASC';
$list = nv_db_cache($sql, '', $module);
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/weather/block.weather.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/weather/block.weather.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block.weather.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/weather');
$xtpl->assign('TEMPLATE', $block_theme);
$xtpl->assign('CODE', $block_config['location']);
$xtpl->assign('NUM_DAY', $block_config['numday']);
foreach ($list as $row) {
$block_config['location'] == $row['location_code'] ? $row['selected'] = ' selected="selected"' : ($row['selected'] = '');
$xtpl->assign('ROW', $row);
$xtpl->parse('main.loop');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
示例8: get_new_record_form
/**
* Create HTML form to enter a new record with the minimum necessary fields.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
*/
function get_new_record_form()
{
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $currentModule;
global $current_user;
global $timedate;
$the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
$form = new XTemplate('modules/Campaigns/Forms.html');
$module_select = empty($_REQUEST['module_select']) ? '' : $_REQUEST['module_select'];
$form->assign('MOD', $mod_strings);
$form->assign('APP', $app_strings);
$form->assign('THEME', SugarThemeRegistry::current()->__toString());
$form->assign("JAVASCRIPT", get_set_focus_js() . get_validate_record_js());
$form->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['campaign_status_dom'], "Planning"));
$form->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['campaign_type_dom'], ""));
$form->assign("USER_ID", $current_user->id);
$form->assign("TEAM_ID", sprintf('<input type="hidden" name="team_id" value="%s">', $current_user->default_team));
$form->assign("CALENDAR_LANG", "en");
$form->assign("USER_DATEFORMAT", '(' . $timedate->get_user_date_format() . ')');
$form->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
$form->parse('main');
$the_form .= $form->text('main');
$focus = BeanFactory::getBean('Campaigns');
$javascript = new javascript();
$javascript->setFormName('quick_save');
$javascript->setSugarBean($focus);
$javascript->addRequiredFields('');
$jscript = $javascript->getScript();
$the_form .= $jscript . get_left_form_footer();
return $the_form;
}
示例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: elseif
/**
* 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 '';
}
}
示例11: send_subcribe_thank_you
function send_subcribe_thank_you($subcriber, $emailto, $code, $user_id)
{
include 'xtemplate.class.php';
$header = 'Content-type: text/html; charset=utf-8\\r\\n';
$title = "You have subcribed at " . get_bloginfo('name');
$contact_email = get_option('contact_email');
if (!is_email($contact_email)) {
$contact_email = get_option('admin_email');
}
$contact_name = get_option('contact_name');
if (!$contact_name) {
$contact_name = get_bloginfo('name');
}
$parseTemplate = new XTemplate('xtemplate-email-subscrib-thank-you.html');
$parseTemplate->assign('subscriber', $subcriber);
$parseTemplate->assign('link', get_bloginfo('home'));
$parseTemplate->assign('website', get_bloginfo('name'));
$parseTemplate->assign('title', $title);
$parseTemplate->assign('code', $code);
$parseTemplate->assign('user_id', $user_id);
$parseTemplate->assign('contact_email', $contact_email);
$parseTemplate->assign('contact_name', $contact_name);
$parseTemplate->parse('main');
wp_mail($emailto, $title, $parseTemplate->text('main'), $header);
}
示例12: XTemplate
function display_page($p)
{
$page = $this->db->quick_query('SELECT * FROM %ppages WHERE page_id=%d', $p);
if (!$page) {
return $this->error('The page you are looking for does not exist. It may have been deleted or the URL is incorrect.', 404);
}
$xtpl = new XTemplate('./skins/' . $this->skin . '/page.xtpl');
$this->title($page['page_title']);
$this->meta_description($page['page_meta']);
$sidebar = null;
$content = $this->format($page['page_content'], $page['page_flags']);
if ($page['page_flags'] & POST_HTML && $page['page_flags'] & POST_BBCODE) {
$content = html_entity_decode($content, ENT_COMPAT, 'UTF-8');
}
$xtpl->assign('content', $content);
if ($page['page_flags'] & POST_SIDEBAR) {
$SideBar = new sidebar($this);
$sidebar = $SideBar->build_sidebar();
$xtpl->parse('Page.HasSidebar');
} else {
$xtpl->parse('Page.NoSidebar');
}
$xtpl->assign('sidebar', $sidebar);
$xtpl->parse('Page');
return $xtpl->text('Page');
}
示例13: XTemplate
function nv_block_archives_search()
{
global $lang_module, $module_name, $module_data, $module_file, $module_config, $module_info, $global_archives_cat, $nv_Request, $array_op;
$q = $nv_Request->get_string('q', 'get', '');
$oid = $nv_Request->get_int('catid', 'get', 0);
if (!empty($global_archives_cat)) {
$xtpl = new XTemplate("block_search.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$xtpl->assign('SEARCH', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=search");
$xtpl->assign('LANG', $lang_module);
foreach ($global_archives_cat as $catid => $catinfo) {
if ($catinfo['parentid'] == '0') {
$xtpl->assign('ROW', $catinfo);
$xtpl->parse('main.loop');
}
$xtitle = "";
if ($catinfo['lev'] > 0) {
for ($i = 1; $i <= $catinfo['lev']; $i++) {
$xtitle .= " ";
}
}
$catinfo['xtitle'] = $xtitle . $catinfo['title'];
$catinfo['select'] = $catinfo['catid'] == $oid ? "selected=\"selected\"" : "";
$xtpl->assign('PAR', $catinfo);
$xtpl->parse('main.parent_loop');
}
$xtpl->assign('text_search', $q);
$xtpl->parse('main');
return $xtpl->text('main');
}
return "";
}
示例14: viewdirtree
/**
* viewdirtree()
*
* @param mixed $dir
* @param mixed $currentpath
* @return
*/
function viewdirtree($dir, $currentpath)
{
global $dirlist, $global_config, $module_file;
$pattern = !empty($dir) ? "/^(" . nv_preg_quote($dir) . ")\\/([^\\/]+)\$/" : "/^([^\\/]+)\$/";
$_dirlist = preg_grep($pattern, $dirlist);
$content = "";
foreach ($_dirlist as $_dir) {
$check_allow_upload_dir = nv_check_allow_upload_dir($_dir);
if (!empty($check_allow_upload_dir)) {
$class_li = ($_dir == $currentpath or strpos($currentpath, $_dir . '/') !== false) ? "open collapsable" : "expandable";
$style_color = $_dir == $currentpath ? ' style="color:red"' : '';
$tree = array();
$tree['class1'] = $class_li;
$tree['class2'] = nv_set_dir_class($check_allow_upload_dir) . " pos" . nv_string_to_filename($dir);
$tree['style'] = $style_color;
$tree['title'] = $_dir;
$tree['titlepath'] = basename($_dir);
$content2 = viewdirtree($_dir, $currentpath);
$xtpl = new XTemplate("foldlist.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file);
$xtpl->assign("DIRTREE", $tree);
if (!empty($content2)) {
$xtpl->assign("TREE_CONTENT", $content2);
$xtpl->parse('tree.tree_content');
}
$xtpl->parse('tree');
$content .= $xtpl->text('tree');
}
}
return $content;
}
示例15: elseif
function nv_block_language($block_config)
{
global $global_config, $site_mods, $lang_global, $language_array;
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/global.block_language.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/blocks/global.block_language.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('global.block_language.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks');
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$xtpl->assign('BLOCK_THEME', $block_theme);
$xtpl->assign('SELECT_LANGUAGE', $lang_global['langsite']);
// Multiple languages
if ($global_config['lang_multi'] and sizeof($global_config['allow_sitelangs']) > 1) {
foreach ($global_config['allow_sitelangs'] as $lang_i) {
$xtpl->assign('LANGSITENAME', $language_array[$lang_i]['name']);
$xtpl->assign('LANGSITEURL', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . $lang_i);
if (NV_LANG_DATA != $lang_i) {
$xtpl->parse('main.language.langitem');
} else {
$xtpl->parse('main.language.langcuritem');
}
}
$xtpl->parse('main.language');
}
$xtpl->parse('main');
return $xtpl->text('main');
}