本文整理汇总了PHP中nv_db_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_db_cache函数的具体用法?PHP nv_db_cache怎么用?PHP nv_db_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nv_db_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nv_block_album_new
function nv_block_album_new($block_config)
{
global $module_photo_category, $module_info, $site_mods, $module_config, $global_config, $db;
$module = $block_config['module'];
$mod_data = $site_mods[$module]['module_data'];
$mod_file = $site_mods[$module]['module_file'];
$db->sqlreset()->select('a.album_id, a.category_id, a.name, a.alias, a.capturelocal, a.description, a.num_photo, a.date_added, r.file, r.thumb')->from(NV_PREFIXLANG . '_' . $mod_data . '_album a LEFT JOIN ' . NV_PREFIXLANG . '_' . $mod_data . '_rows r ON ( a.album_id = r.album_id )')->where('a.status= 1 AND r.defaults = 1')->order('a.date_added DESC')->limit($block_config['numrow']);
$list = nv_db_cache($db->sql(), 'album_id', $module);
if (!empty($list)) {
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/photo/block_album_new.tpl')) {
$block_theme = $global_config['module_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block_album_new.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/photo');
foreach ($list as $album) {
$album['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_photo_category[$album['category_id']]['alias'] . '/' . $album['alias'] . '-' . $album['album_id'] . $global_config['rewrite_exturl'];
$album['description'] = strip_tags(nv_clean60($album['description'], 100));
$album['datePublished'] = date('Y-m-d', $album['date_added']);
$album['thumb'] = creat_thumbs($album['album_id'], $album['file'], $module, 270, 210, 90);
$album['file'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module . '/images/' . $album['file'];
$xtpl->assign('ALBUM', $album);
$xtpl->parse('main.loop_album');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
}
示例2: nv_block_config_form_content
function nv_block_config_form_content($module, $data_block, $lang_block)
{
global $site_mods;
$html = '';
$html .= '<tr>';
$html .= '<td>' . $lang_block['formid'] . '</td>';
$html .= '<td><select name="config_formid" class="form-control">';
$html .= '<option value="0"> -- </option>';
$sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . ' WHERE status = 1 ORDER BY weight ASC';
$list = nv_db_cache($sql, '', $module);
foreach ($list as $l) {
$html .= '<option value="' . $l['id'] . '" ' . ($data_block['formid'] == $l['id'] ? ' selected="selected"' : '') . '>' . $l['title'] . '</option>';
}
$html .= '</select>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td>' . $lang_block['dis_form_info'] . '</td>';
$ck = $data_block['dis_form_info'] ? 'checked="checked"' : '';
$html .= '<td><input type="checkbox" name="config_dis_form_info" value="1" ' . $ck . ' /></td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td>' . $lang_block['dis_form_answered'] . '</td>';
$ck = $data_block['dis_form_answered'] ? 'checked="checked"' : '';
$html .= '<td><input type="checkbox" name="config_dis_form_answered" value="1" ' . $ck . ' /></td>';
$html .= '</tr>';
return $html;
}
示例3: nv_mod_down_config
/**
* nv_mod_down_config()
*
* @return
*/
function nv_mod_down_config()
{
global $module_name, $module_data, $module_name;
$sql = "SELECT config_name,config_value FROM " . NV_PREFIXLANG . "_" . $module_data . "_config";
$list = nv_db_cache($sql);
$download_config = array();
foreach ($list as $values) {
$download_config[$values['config_name']] = $values['config_value'];
}
$download_config['upload_filetype'] = !empty($download_config['upload_filetype']) ? explode(',', $download_config['upload_filetype']) : array();
if (!empty($download_config['upload_filetype'])) {
$download_config['upload_filetype'] = array_map("trim", $download_config['upload_filetype']);
}
if (empty($download_config['upload_filetype'])) {
$download_config['is_upload'] = 0;
}
if ($download_config['is_addfile']) {
$download_config['is_addfile_allow'] = nv_user_in_groups($download_config['groups_addfile']);
} else {
$download_config['is_addfile_allow'] = false;
}
if ($download_config['is_addfile_allow'] and $download_config['is_upload']) {
$download_config['is_upload_allow'] = nv_user_in_groups($download_config['groups_upload']);
} else {
$download_config['is_upload_allow'] = false;
}
return $download_config;
}
示例4: nv_weather_blocks
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');
}
示例5: nv_mod_down_config
function nv_mod_down_config($module)
{
global $site_mods, $module_info;
$sql = 'SELECT config_name,config_value FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_file'] . '_config';
$list = nv_db_cache($sql, '', $module);
$download_config = array();
foreach ($list as $values) {
$download_config[$values['config_name']] = $values['config_value'];
}
$download_config['upload_filetype'] = !empty($download_config['upload_filetype']) ? explode(',', $download_config['upload_filetype']) : array();
if (!empty($download_config['upload_filetype'])) {
$download_config['upload_filetype'] = array_map('trim', $download_config['upload_filetype']);
}
if (empty($download_config['upload_filetype'])) {
$download_config['is_upload'] = 0;
}
if ($download_config['is_addfile']) {
$download_config['is_addfile_allow'] = nv_user_in_groups($download_config['groups_addfile']);
} else {
$download_config['is_addfile_allow'] = false;
}
if ($download_config['is_addfile_allow'] and $download_config['is_upload']) {
$download_config['is_upload_allow'] = nv_user_in_groups($download_config['groups_upload']);
} else {
$download_config['is_upload_allow'] = false;
}
return $download_config;
}
示例6: nv_block_config_filter_product_cat
/**
* nv_block_config_filter_product_cat()
*
* @param mixed $module
* @param mixed $data_block
* @param mixed $lang_block
* @return
*/
function nv_block_config_filter_product_cat($module, $data_block, $lang_block)
{
global $db_config, $site_mods;
$html = '';
$html .= "<tr>";
$html .= "\t<td>" . $lang_block['content'] . "</td>";
$sql = 'SELECT * FROM ' . $db_config['prefix'] . '_' . $site_mods[$module]['module_data'] . '_group WHERE parentid = 0 ORDER BY weight';
$list = nv_db_cache($sql, '', $module);
$array_style = array('checkbox' => 'Checkbox', 'label' => 'Label', 'image' => 'Image');
$html .= "\t<td><div class=\"row\">";
foreach ($list as $l) {
$html .= "<div class=\"col-sm-6\">";
$html .= $l[NV_LANG_DATA . '_title'];
$html .= "</div>";
$html .= "<div class=\"col-sm-18\">";
foreach ($array_style as $key => $style) {
$ck = $data_block['group_style'][$l['groupid']] == $key ? 'checked="checked"' : '';
$html .= "<label><input type=\"radio\" name=\"config_group_style[" . $l['groupid'] . "]\" value=\"" . $key . "\" " . $ck . " />" . $style . "</label> ";
}
$html .= "</div>";
}
$html .= " </div></td>";
$html .= "</tr>";
return $html;
}
示例7: 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 '';
}
}
示例8: nv_mod_down_config
function nv_mod_down_config($module_data)
{
global $site_mods, $module_info;
$sql = "SELECT `config_name`,`config_value` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_config`";
$list = nv_db_cache($sql);
$download_config = array();
foreach ($list as $values) {
$download_config[$values['config_name']] = $values['config_value'];
}
$download_config['upload_filetype'] = !empty($download_config['upload_filetype']) ? explode(",", $download_config['upload_filetype']) : array();
if (!empty($download_config['upload_filetype'])) {
$download_config['upload_filetype'] = array_map("trim", $download_config['upload_filetype']);
}
if (empty($download_config['upload_filetype'])) {
$download_config['is_upload'] = 0;
}
if ($download_config['is_addfile']) {
$download_config['is_addfile_allow'] = nv_set_allow($download_config['who_addfile'], $download_config['groups_addfile']);
} else {
$download_config['is_addfile_allow'] = false;
}
if ($download_config['is_addfile_allow'] and $download_config['is_upload']) {
$download_config['is_upload_allow'] = nv_set_allow($download_config['who_upload'], $download_config['groups_upload']);
} else {
$download_config['is_upload_allow'] = false;
}
$download_config['is_autocomment_allow'] = nv_set_allow($download_config['who_autocomment'], $download_config['groups_autocomment']);
return $download_config;
}
示例9: nv_block_config_tab_catid
function nv_block_config_tab_catid($module, $data_block, $lang_block)
{
global $site_mods;
$html = '';
$html .= '<tr>';
$html .= '<td>' . $lang_block['config_catid'] . '</td>';
$html .= '<td><select name="config_catid" class="form-control w200">';
$html .= '<option value="0"> --- Chọn chuyên mục --- </option>';
$sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_cat ORDER BY sort ASC';
$list = nv_db_cache($sql, '', $module);
foreach ($list as $l) {
$xtitle_i = "";
if ($l['lev'] > 0) {
$xtitle_i .= " |";
for ($i = 1; $i <= $l['lev']; ++$i) {
$xtitle_i .= "---";
}
$xtitle_i .= "> ";
}
$xtitle_i .= $l['title'] . '-' . $l['catid'];
$html .= '<option value="' . $l['catid'] . '" ' . ($data_block['config_catid'] == $l['catid'] ? ' selected="selected"' : '') . '>' . $xtitle_i . '</option>';
}
$html .= '</select>';
$html .= '</td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td>' . $lang_block['config_numrow'] . '</td>';
$html .= '<td><input type="text" class="form-control w200" name="config_numrow" size="5" value="' . $data_block['config_numrow'] . '"/></td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td>' . $lang_block['config_numcut'] . '</td>';
$html .= '<td><input type="text" class="form-control w200" name="config_numcut" size="5" value="' . $data_block['config_numcut'] . '"/></td>';
$html .= '</tr>';
return $html;
}
示例10: 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 '';
}
}
示例11: nv_product_center
/**
* nv_product_center()
*
* @return
*/
function nv_product_center($block_config)
{
global $module_name, $lang_module, $module_info, $module_file, $global_array_shops_cat, $db, $module_data, $db_config, $pro_config, $global_config, $site_mods;
$module = $block_config['module'];
$num_view = 5;
$num = 30;
$array = array();
$xtpl = new XTemplate('block.product_center.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('THEME_TEM', NV_BASE_SITEURL . 'themes/' . $module_info['template']);
$xtpl->assign('WIDTH', $pro_config['homewidth']);
$xtpl->assign('NUMVIEW', $num_view);
$cache_file = NV_LANG_DATA . '_block_module_product_center_' . NV_CACHE_PREFIX . '.cache';
if (($cache = nv_get_cache($module_name, $cache_file)) != false) {
$array = unserialize($cache);
} else {
$db->sqlreset()->select('bid')->from($db_config['prefix'] . '_' . $module_data . '_block_cat')->order('weight ASC')->limit(1);
$result = $db->query($db->sql());
$bid = $result->fetchColumn();
$db->sqlreset()->select('t1.id, t1.listcatid, t1.' . NV_LANG_DATA . '_title AS title, t1.' . NV_LANG_DATA . '_alias AS alias, t1.homeimgfile, t1.homeimgthumb , t1.homeimgalt, t1.showprice, t1.discount_id')->from($db_config['prefix'] . '_' . $module_data . '_rows t1')->join('INNER JOIN ' . $db_config['prefix'] . '_' . $module_data . '_block t2 ON t1.id = t2.id')->where('t2.bid= ' . $bid . ' AND t1.status =1')->order('t1.id DESC')->limit($num);
$array = nv_db_cache($db->sql(), 'id', $module_name);
$cache = serialize($array);
nv_set_cache($module_name, $cache_file, $cache);
}
foreach ($array as $row) {
$link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_shops_cat[$row['listcatid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl'];
if ($row['homeimgthumb'] == 1) {
$src_img = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $row['homeimgfile'];
} elseif ($row['homeimgthumb'] == 2) {
$src_img = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $row['homeimgfile'];
} elseif ($row['homeimgthumb'] == 3) {
$src_img = $row['homeimgfile'];
} else {
$src_img = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/shops/no-image.jpg';
}
$xtpl->assign('LINK', $link);
$xtpl->assign('TITLE', $row['title']);
$xtpl->assign('TITLE0', nv_clean60($row['title'], 30));
$xtpl->assign('SRC_IMG', $src_img);
if ($pro_config['active_price'] == '1') {
if ($row['showprice'] == '1') {
$price = nv_get_price($row['id'], $pro_config['money_unit']);
$xtpl->assign('PRICE', $price);
if ($row['discount_id'] and $price['discount_percent'] > 0) {
$xtpl->parse('main.items.price.discounts');
} else {
$xtpl->parse('main.items.price.no_discounts');
}
$xtpl->parse('main.items.price');
} else {
$xtpl->parse('main.items.contact');
}
}
$xtpl->parse('main.items');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
示例12: nv_menu_blocks
/**
* nv_menu_blocks()
*
* Ham xu ly chinh cho block
*
* @param mixed $block_config
* @return
*/
function nv_menu_blocks($block_config)
{
global $db, $global_config, $my_head;
$list_cats = array();
$sql = 'SELECT id, parentid, title, link, icon, note, subitem, groups_view, module_name, op, target, css, active_type FROM ' . NV_PREFIXLANG . '_menu_rows WHERE status=1 AND mid = ' . $block_config['menuid'] . ' ORDER BY weight ASC';
$list = nv_db_cache($sql, '', $block_config['module']);
foreach ($list as $row) {
if (nv_user_in_groups($row['groups_view'])) {
switch ($row['target']) {
case 1:
$row['target'] = '';
break;
case 3:
$row['target'] = ' onclick="window.open(this.href,\'targetWindow\',\'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,\');return false;"';
break;
default:
$row['target'] = ' onclick="this.target=\'_blank\'"';
}
if (!empty($row['icon']) and file_exists(NV_UPLOADS_REAL_DIR . '/menu/' . $row['icon'])) {
$row['icon'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/menu/' . $row['icon'];
} else {
$row['icon'] = '';
}
$list_cats[$row['id']] = array('id' => $row['id'], 'parentid' => $row['parentid'], 'subcats' => $row['subitem'], 'title' => $row['title'], 'title_trim' => nv_clean60($row['title'], $block_config['title_length']), 'target' => $row['target'], 'note' => empty($row['note']) ? $row['title'] : $row['note'], 'link' => nv_url_rewrite(nv_unhtmlspecialchars($row['link']), true), 'icon' => $row['icon'], 'html_class' => $row['css'], 'current' => nv_menu_check_current($row['link'], (int) $row['active_type']));
}
}
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/menu/' . $block_config['block_name'] . '.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/menu/' . $block_config['block_name'] . '.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate($block_config['block_name'] . '.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/menu');
$xtpl->assign('BLOCK_THEME', $block_theme);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
foreach ($list_cats as $cat) {
if (empty($cat['parentid'])) {
$cat['class'] = nv_menu_blocks_active($cat);
$xtpl->assign('CAT1', $cat);
if (!empty($cat['icon'])) {
$xtpl->parse('main.loopcat1.icon');
}
if (!empty($cat['subcats'])) {
$html_content = nv_smenu_blocks($block_config['block_name'], $list_cats, $cat['subcats']);
$xtpl->assign('HTML_CONTENT', $html_content);
if ($html_content != '') {
$xtpl->parse('main.loopcat1.cat2');
$xtpl->parse('main.loopcat1.expand');
}
}
$xtpl->parse('main.loopcat1');
}
}
$xtpl->assign('MENUID', $block_config['bid']);
$xtpl->parse('main');
return $xtpl->text('main');
}
示例13: nv_block_news_groups_multi_tabs
function nv_block_news_groups_multi_tabs($block_config)
{
global $module_array_cat, $module_info, $site_mods, $module_config, $global_config, $db;
$module = $block_config['module'];
$show_no_image = $module_config[$module]['show_no_image'];
$blockwidth = $module_config[$module]['blockwidth'];
if (empty($block_config['blockid'])) {
return '';
}
$blockid = implode(',', $block_config['blockid']);
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/news/block_groups_multi_tabs.tpl')) {
$block_theme = $global_config['module_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block_groups_multi_tabs.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/news');
$n = 0;
$sql = 'SELECT bid, title FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_block_cat WHERE bid IN ( ' . $blockid . ' ) ORDER BY weight ASC';
$result = $db->query($sql);
while ($data = $result->fetch()) {
$n++;
if ($n == 1) {
$data['active'] = 'active';
}
$xtpl->assign('BLOCK_INFO', $data);
$xtpl->parse('main.group_info');
$db->sqlreset()->select('t1.id, t1.catid, t1.title, t1.alias, t1.homeimgfile, t1.homeimgthumb,t1.hometext,t1.publtime')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_rows t1')->join('INNER JOIN ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_block t2 ON t1.id = t2.id')->where('t2.bid= ' . $data['bid'] . ' AND t1.status= 1')->order('t2.weight ASC')->limit($block_config['numrow']);
$list = nv_db_cache($db->sql(), '', $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 . '=' . $module_array_cat[$l['catid']]['alias'] . '/' . $l['alias'] . '-' . $l['id'] . $global_config['rewrite_exturl'];
if ($l['homeimgthumb'] == 1) {
$l['thumb'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile'];
} elseif ($l['homeimgthumb'] == 2) {
$l['thumb'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile'];
} elseif ($l['homeimgthumb'] == 3) {
$l['thumb'] = $l['homeimgfile'];
} elseif (!empty($show_no_image)) {
$l['thumb'] = NV_BASE_SITEURL . $show_no_image;
} else {
$l['thumb'] = '';
}
$l['bid'] = $data['bid'];
$l['blockwidth'] = $blockwidth;
$l['title'] = nv_clean60($l['title'], $block_config['title_length']);
$xtpl->assign('ROW', $l);
if (!empty($l['thumb'])) {
$xtpl->parse('main.group_content.loop.img');
}
$xtpl->parse('main.group_content.loop');
}
$xtpl->parse('main.group_content');
}
}
$xtpl->parse('main');
return $xtpl->text('main');
}
示例14: nv_news_block_newscenter
function nv_news_block_newscenter($block_config)
{
global $module_data, $module_name, $module_file, $global_array_cat, $global_config, $lang_module, $db, $module_config, $module_info;
$module_name = 'news';
$module_data = 'news';
$xtpl = new XTemplate('block_newscenter.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/blocks');
$xtpl->assign('lang', $lang_module);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$db->sqlreset()->select('id, catid, publtime, title, alias, hometext, homeimgthumb, homeimgfile')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->where('status= 1')->order('publtime DESC')->limit(5);
$list = nv_db_cache($db->sql(), 'id', $module_name);
$i = 1;
foreach ($list as $row) {
$row['publtime'] = nv_date('m/d/Y', $row['publtime']);
$row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_cat[$row['catid']]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'];
$row['title0'] = nv_clean60(strip_tags($row['title']), $i == 1 ? 50 : 30);
$row['hometext'] = nv_clean60(strip_tags($row['hometext']), 260);
$image = NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $row['homeimgfile'];
if ($row['homeimgfile'] != '' and file_exists($image)) {
if ($i == 1) {
$width = 570;
$height = 490;
} else {
$width = 270;
$height = 230;
}
$row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $row['homeimgfile'];
$imginfo = nv_is_image($image);
$basename = basename($image);
if ($imginfo['width'] > $width or $imginfo['height'] > $height) {
$basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $row['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
} else {
require_once NV_ROOTDIR . '/includes/class/image.class.php';
$_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$_image->cropFromCenter($width, $height);
$_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
}
}
}
} elseif (nv_is_url($row['homeimgfile'])) {
$row['imgsource'] = $row['homeimgfile'];
} elseif (!empty($module_config[$module_name]['show_no_image'])) {
$row['imgsource'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image'];
} else {
$row['imgsource'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no-image.png';
}
$xtpl->assign('main' . $i, $row);
++$i;
}
$xtpl->parse('main');
return $xtpl->text('main');
}
示例15: initial_config_data
/**
* initial_config_data()
*
* @return
*/
function initial_config_data()
{
global $module_data;
$sql = "SELECT config_name, config_value FROM " . NV_PREFIXLANG . "_" . $module_data . "_config";
$list = nv_db_cache($sql);
$module_setting = array();
foreach ($list as $values) {
$module_setting[$values['config_name']] = $values['config_value'];
}
return $module_setting;
}