当前位置: 首页>>代码示例>>PHP>>正文


PHP XTemplate::set_autoreset方法代码示例

本文整理汇总了PHP中XTemplate::set_autoreset方法的典型用法代码示例。如果您正苦于以下问题:PHP XTemplate::set_autoreset方法的具体用法?PHP XTemplate::set_autoreset怎么用?PHP XTemplate::set_autoreset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XTemplate的用法示例。


在下文中一共展示了XTemplate::set_autoreset方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: nv_error_info

/**
 * nv_error_info()
 *
 * @return
 */
function nv_error_info()
{
    global $lang_global, $global_config, $error_info;
    if (!defined('NV_IS_ADMIN')) {
        return;
    }
    if (empty($error_info)) {
        return;
    }
    $errortype = array(E_ERROR => array($lang_global['error_error'], 'bad.png'), E_WARNING => array($lang_global['error_warning'], 'warning.png'), E_PARSE => array($lang_global['error_error'], 'bad.png'), E_NOTICE => array($lang_global['error_notice'], 'comment.png'), E_CORE_ERROR => array($lang_global['error_error'], 'bad.png'), E_CORE_WARNING => array($lang_global['error_warning'], 'warning.png'), E_COMPILE_ERROR => array($lang_global['error_error'], 'bad.png'), E_COMPILE_WARNING => array($lang_global['error_warning'], 'warning.png'), E_USER_ERROR => array($lang_global['error_error'], 'bad.png'), E_USER_WARNING => array($lang_global['error_warning'], 'warning.png'), E_USER_NOTICE => array($lang_global['error_notice'], 'comment.png'), E_STRICT => array($lang_global['error_notice'], 'comment.png'), E_RECOVERABLE_ERROR => array($lang_global['error_error'], 'bad.png'), E_DEPRECATED => array($lang_global['error_notice'], 'comment.png'), E_USER_DEPRECATED => array($lang_global['error_warning'], 'warning.png'));
    if (defined('NV_ADMIN') and file_exists(NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/system/error_info.tpl')) {
        $tpl_path = NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/system';
        $image_path = NV_BASE_SITEURL . 'themes/' . $global_config['admin_theme'] . '/images/icons/';
    } elseif (defined('NV_ADMIN')) {
        $tpl_path = NV_ROOTDIR . '/themes/admin_default/system';
        $image_path = NV_BASE_SITEURL . 'themes/admin_default/images/';
    } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/system/error_info.tpl')) {
        $tpl_path = NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/system';
        $image_path = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/icons/';
    } else {
        $tpl_path = NV_ROOTDIR . '/themes/default/system';
        $image_path = NV_BASE_SITEURL . 'themes/default/images/icons/';
    }
    $xtpl = new XTemplate('error_info.tpl', $tpl_path);
    $xtpl->assign('TPL_E_CAPTION', $lang_global['error_info_caption']);
    $a = 0;
    foreach ($error_info as $key => $value) {
        $xtpl->assign('TPL_E_CLASS', $a % 2 ? ' class="second"' : '');
        $xtpl->assign('TPL_E_ALT', $errortype[$value['errno']][0]);
        $xtpl->assign('TPL_E_SRC', $image_path . $errortype[$value['errno']][1]);
        $xtpl->assign('TPL_E_ERRNO', $errortype[$value['errno']][0]);
        $xtpl->assign('TPL_E_MESS', $value['info']);
        $xtpl->set_autoreset();
        $xtpl->parse('error_info.error_item');
        ++$a;
    }
    $xtpl->parse('error_info');
    return $xtpl->text('error_info');
}
开发者ID:lzhao18,项目名称:nukeviet,代码行数:44,代码来源:theme_functions.php

示例2: home_view_grid_by_album

/**
 * home_view_grid_by_album()
 * 
 * @param mixed $array_data
 * @return
 */
function home_view_grid_by_album($array_album)
{
    global $global_config, $global_photo_cat, $module_name, $module_upload, $module_file, $lang_module, $photo_config, $module_info, $op;
    $xtpl = new XTemplate('home_view_grid.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    $xtpl->assign('TEMPLATE', $module_info['template']);
    $xtpl->assign('MODULE_FILE', $module_file);
    $xtpl->assign('OP', $op);
    if (!empty($array_album)) {
        foreach ($array_album as $album) {
            $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_upload, 270, 210, 90);
            $album['file'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/images/' . $album['file'];
            $xtpl->assign('ALBUM', $album);
            $xtpl->parse('main.grid_album.loop_album');
            $xtpl->set_autoreset();
        }
        $xtpl->parse('main.grid_album');
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
开发者ID:hpleduit,项目名称:module_photos,代码行数:30,代码来源:theme.php

示例3: viewsubcat_main

function viewsubcat_main($viewcat, $array_cat)
{
    global $module_name, $module_file, $global_array_cat, $lang_module, $module_config, $module_info;
    $xtpl = new XTemplate($viewcat . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('TOOLTIP_POSITION', $module_config[$module_name]['showtooltip'] ? $module_config[$module_name]['tooltip_position'] : '');
    $xtpl->assign('MODULE_NAME', $module_file);
    $xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']);
    $xtpl->assign('IMGHEIGHT', $module_config[$module_name]['homeheight']);
    // Hien thi cac chu de con
    foreach ($array_cat as $key => $array_row_i) {
        if (isset($array_cat[$key]['content'])) {
            $array_row_i['rss'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $module_info['alias']['rss'] . "/" . $array_row_i['alias'];
            $xtpl->assign('CAT', $array_row_i);
            $catid = intval($array_row_i['catid']);
            if ($array_row_i['subcatid'] != '') {
                $_arr_subcat = explode(',', $array_row_i['subcatid']);
                foreach ($_arr_subcat as $catid_i) {
                    if ($global_array_cat[$catid_i]['inhome'] == 1) {
                        $xtpl->assign('SUBCAT', $global_array_cat[$catid_i]);
                        $xtpl->parse('main.listcat.subcatloop');
                    }
                }
            }
            foreach ($array_cat[$key]['content'] as $array_row_i) {
                $newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday'];
                $array_row_i['publtime'] = humanTiming($array_row_i['publtime']);
                $array_row_i['title_cut'] = nv_clean60($array_row_i['title'], $module_config[$module_name]['titlecut'], true);
                if ($newday >= NV_CURRENTTIME) {
                    $xtpl->parse('main.listcat.loop.newday');
                }
                $xtpl->assign('CONTENT', $array_row_i);
                if ($array_row_i['imghome'] != "") {
                    if (!($array_row_i['homeimgthumb'] > 0)) {
                        $xtpl->parse('main.listcat.loop.image.fix_size');
                    }
                    $xtpl->assign('HOMEIMG', $array_row_i['imghome']);
                    $xtpl->assign('HOMEIMGALT', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']);
                    $xtpl->parse('main.listcat.loop.image');
                }
                if (defined('NV_IS_MODADMIN')) {
                    $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " " . nv_link_delete_page($array_row_i['id']));
                    $xtpl->parse('main.listcat.loop.adminlink');
                }
                if (isset($array_row_i['uploader_link']) and !empty($array_row_i['uploader_link'])) {
                    $xtpl->parse('main.listcat.loop.uploader_link');
                } else {
                    $xtpl->parse('main.listcat.loop.uploader');
                }
                if ($array_row_i['hitstotal'] > 0) {
                    $xtpl->parse('main.listcat.loop.hitstotal');
                }
                $xtpl->set_autoreset();
                $xtpl->parse('main.listcat.loop');
            }
            $xtpl->parse('main.listcat');
        }
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
开发者ID:hongoctrien,项目名称:module-videos,代码行数:61,代码来源:theme.php

示例4: cledit_theme

function cledit_theme($contents)
{
    global $global_config, $module_name, $module_file, $module_info;
    $xtpl = new XTemplate("cledit.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);
    foreach ($contents['rows'] as $row) {
        $xtpl->clear_autoreset();
        $xtpl->assign('LT_NAME', $row[0]);
        $xtpl->assign('LT_ID', $row[1]);
        $xtpl->assign('LT_VALUE', $row[2]);
        $xtpl->assign('LT_MAXLENGTH', $row[3]);
        $xtpl->set_autoreset();
        $xtpl->parse('cledit.lt');
    }
    foreach ($contents['npass'] as $row) {
        $xtpl->clear_autoreset();
        $xtpl->assign('NPASS_NAME', $row[0]);
        $xtpl->assign('NPASS_ID', $row[1]);
        $xtpl->assign('NPASS_MAXLENGTH', $row[2]);
        $xtpl->set_autoreset();
        $xtpl->parse('cledit.npass');
    }
    $xtpl->assign('EDIT_NAME', $contents['edit_name']);
    $xtpl->assign('EDIT_ONCLICK', $contents['edit_onclick']);
    $xtpl->assign('EDIT_ID', $contents['edit_id']);
    $xtpl->assign('CANCEL_NAME', $contents['cancel_name']);
    $xtpl->assign('CANCEL_ONCLICK', $contents['cancel_onclick']);
    $xtpl->parse('cledit');
    return $xtpl->text('cledit');
}
开发者ID:syphuonglam,项目名称:creative-portal,代码行数:29,代码来源:theme.php

示例5: viewsubfam_main

function viewsubfam_main($viewfam, $array_fam)
{
    global $module_name, $module_file, $global_array_fam, $lang_module, $module_config, $module_info;
    $xtpl = new XTemplate($viewfam . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('TOOLTIP_POSITION', $module_config[$module_name]['showtooltip'] ? $module_config[$module_name]['tooltip_position'] : '');
    // Hien thi cac chu de con
    foreach ($array_fam as $key => $array_row_i) {
        if (isset($array_fam[$key]['content'])) {
            $array_row_i['rss'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $module_info['alias']['rss'] . "/" . $array_row_i['alias'];
            $xtpl->assign('FAM', $array_row_i);
            $fid = intval($array_row_i['fid']);
            if ($array_row_i['subfid'] != '') {
                $_arr_subfam = explode(',', $array_row_i['subfid']);
                foreach ($_arr_subfam as $fid_i) {
                    if ($global_array_fam[$fid_i]['inhome'] == 1) {
                        $xtpl->assign('SUBFAM', $global_array_fam[$fid_i]);
                        $xtpl->parse('main.listfam.subfamloop');
                    }
                }
            }
            $a = 0;
            $xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']);
            foreach ($array_fam[$key]['content'] as $array_row_i) {
                $newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday'];
                $array_row_i['publtime'] = nv_date('d/m/Y H:i', $array_row_i['publtime']);
                ++$a;
                if ($a == 1) {
                    if ($newday >= NV_CURRENTTIME) {
                        $xtpl->parse('main.listfam.newday');
                    }
                    $xtpl->assign('CONTENT', $array_row_i);
                    if ($array_row_i['imghome'] != "") {
                        $xtpl->assign('HOMEIMG', $array_row_i['imghome']);
                        $xtpl->assign('HOMEIMGALT', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']);
                        $xtpl->parse('main.listfam.image');
                    }
                    if (defined('NV_IS_MODADMIN')) {
                        $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " " . nv_link_delete_page($array_row_i['id']));
                        $xtpl->parse('main.listfam.adminlink');
                    }
                } else {
                    if ($newday >= NV_CURRENTTIME) {
                        $xtpl->assign('CLASS', 'icon_new_small');
                    } else {
                        $xtpl->assign('CLASS', 'icon_list');
                    }
                    $array_row_i['hometext'] = nv_clean60($array_row_i['hometext'], $module_config[$module_name]['tooltip_length'], true);
                    $xtpl->assign('OTHER', $array_row_i);
                    $xtpl->parse('main.listfam.related.loop');
                }
                if ($a > 1) {
                    $xtpl->assign('WCT', 'col-md-16 ');
                } else {
                    $xtpl->assign('WCT', '');
                }
                $xtpl->set_autoreset();
            }
            if ($a > 1) {
                $xtpl->parse('main.listfam.related');
            }
            $xtpl->parse('main.listfam');
        }
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
开发者ID:hoangvtien,项目名称:nv4_module_genealogy,代码行数:67,代码来源:theme.php

示例6: home_view_grid_by_album

/**
 * home_view_grid_by_album()
 * 
 * @param mixed $array_data
 * @return
 */
function home_view_grid_by_album($array_album, $generate_page)
{
    global $global_config, $global_photo_cat, $module_name, $module_upload, $module_file, $op_file, $lang_module, $module_config, $module_info, $op;
    $xtpl = new XTemplate('home_view_grid.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    $xtpl->assign('TEMPLATE', $module_info['template']);
    $xtpl->assign('MODULE_FILE', $module_file);
    $xtpl->assign('OP', $op);
    $per_line = 24 / $module_config[$module_name]['per_line'];
    $xtpl->assign('PER_LINE', $per_line);
    if (isset($module_config[$module_name]['home_layout']) && !empty($module_config[$module_name]['home_layout'])) {
        $module_info['layout_funcs'][$op_file] = $module_config[$module_name]['home_layout'];
    }
    if (!empty($array_album)) {
        foreach ($array_album as $album) {
            if (isset($module_config[$module_name]['home_title_cut']) && !empty($module_config[$module_name]['home_title_cut'])) {
                $album['name'] = nv_clean60($album['name'], $module_config[$module_name]['home_title_cut']);
            }
            $album['description'] = nv_clean60($album['description'], 100);
            $album['date_added'] = nv_date('d/m/Y', $album['date_added']);
            $album['thumb'] = photos_thumbs($album['album_id'], $album['file'], $module_upload, $module_config[$module_name]['cr_thumb_width'], $module_config[$module_name]['cr_thumb_height'], $module_config[$module_name]['cr_thumb_quality']);
            $album['file'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/images/' . $album['file'];
            $xtpl->assign('ALBUM', $album);
            $xtpl->parse('main.grid_album.loop_album');
            $xtpl->set_autoreset();
        }
        $xtpl->parse('main.grid_album');
    }
    if (!empty($generate_page)) {
        $xtpl->assign('GENERATE_PAGE', $generate_page);
        $xtpl->parse('main.generate_page');
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
开发者ID:hoangvtien,项目名称:module-photos,代码行数:42,代码来源:theme.php

示例7: viewsubcat_main

function viewsubcat_main($viewcat, $array_cat)
{
    global $global_config, $module_name, $module_file, $global_array_cat, $lang_module, $module_config, $module_info;
    $xtpl = new XTemplate("viewcat_main_bottom.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);
    $xtpl->assign('LANG', $lang_module);
    // Hien thi cac chu de con
    foreach ($array_cat as $key => $array_row_i) {
        if (isset($array_cat[$key]['content'])) {
            $xtpl->assign('CAT', $array_row_i);
            $catid = intval($array_row_i['catid']);
            if ($array_row_i['subcatid'] != "") {
                $exl = 0;
                $arrsubcat_s = explode(",", $array_row_i['subcatid']);
                foreach ($arrsubcat_s as $subcatid_i) {
                    if ($global_array_cat[$subcatid_i]['inhome'] == 1) {
                        $xtpl->clear_autoreset();
                        if ($exl < 3) {
                            $xtpl->assign('SUBCAT', $global_array_cat[$subcatid_i]);
                            $xtpl->parse('main.listcat.subcatloop');
                            $xtpl->set_autoreset();
                        } else {
                            $more = array('title' => $lang_module['more'], 'link' => $global_array_cat[$catid]['link']);
                            $xtpl->assign('MORE', $more);
                            $xtpl->parse('main.listcat.subcatmore');
                            $xtpl->set_autoreset();
                            break;
                        }
                        ++$exl;
                    }
                }
            }
            $a = 0;
            $xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']);
            foreach ($array_cat[$key]['content'] as $array_row_i) {
                $array_row_i['publtime'] = nv_date('d-m-Y h:i:s A', $array_row_i['publtime']);
                ++$a;
                if ($a == 1) {
                    $xtpl->assign('CONTENT', $array_row_i);
                    if ($array_row_i['imghome'] != "") {
                        $xtpl->assign('HOMEIMG', $array_row_i['imghome']);
                        $xtpl->assign('HOMEIMGALT', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']);
                        $xtpl->parse('main.listcat.image');
                    }
                    if (defined('NV_IS_MODADMIN')) {
                        $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . "&nbsp;-&nbsp;" . nv_link_delete_page($array_row_i['id']));
                        $xtpl->parse('main.listcat.adminlink');
                    }
                } else {
                    $xtpl->assign('OTHER', $array_row_i);
                    $xtpl->parse('main.listcat.related.loop');
                }
                if ($a > 1) {
                    if ($viewcat == "viewcat_main_right") {
                        $xtpl->assign('BORDER', 'border_r ');
                    } elseif ($viewcat == "viewcat_main_left") {
                        $xtpl->assign('BORDER', 'border_l ');
                    } else {
                        $xtpl->assign('BORDER', 'border_b ');
                    }
                    $xtpl->assign('WCT', 'fixedwidth ');
                } else {
                    $xtpl->assign('WCT', 'fullwidth noborder ');
                }
                $xtpl->set_autoreset();
            }
            if ($a > 1) {
                $xtpl->parse('main.listcat.related');
            }
            $xtpl->parse('main.listcat');
        }
    }
    // het Hien thi cac chu de con
    $xtpl->parse('main');
    return $xtpl->text('main');
}
开发者ID:atarubi,项目名称:nuke-viet,代码行数:75,代码来源:theme.php

示例8:

    $xtpl->parse('main.table.row');
}
// parse the table (Table 1)
$xtpl->parse('main.table');
/**
 * now, if you wanted to parse the table once again with the old rows,
 * and put one more $xtpl->parse('main.table') line, it wouldn't do it
 * becuase the sub-blocks were resetted (normal operation)
 * to parse the same block two or more times without having the sub-blocks resetted,
 * you should use clear_autoreset();
 * to switch back call set_autoreset();
 */
$xtpl->clear_autoreset();
for ($i = 1; $i <= $rowsize; $i++) {
    // assign array data
    $xtpl->assign('DATA', $rows[$i]);
    $xtpl->assign('ROW_NR', $i);
    // parse a row
    $xtpl->parse('main.table.row');
}
// parse the table (Table 2)
$xtpl->parse('main.table');
// Turn the autoreset back on - the sub-block will be reset after the next table parse
$xtpl->set_autoreset();
// parse it one more time.. the rows are still there from the last parse of table (2)
// the set_autoreset on the previous line means the rows are cleared during this parse (sub-block reset) (Table 3)
$xtpl->parse('main.table');
// re-parse the table block (Table 4)
$xtpl->parse('main.table');
$xtpl->parse('main');
$xtpl->out('main');
开发者ID:D3Cnet,项目名称:cuisine,代码行数:31,代码来源:ex3.php

示例9: viewcat_new_head

function viewcat_new_head($array_catpage, $array_cat_other)
{
    global $global_config, $module_name, $module_file, $lang_module, $module_config, $module_info;
    $xtpl = new XTemplate("viewcat_new_head.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $a = 0;
    foreach ($array_catpage as $array_row_i) {
        $array_row_i['publtime'] = nv_date('d/m/Y H:i', $array_row_i['publtime']);
        $xtpl->clear_autoreset();
        if ($a == 0) {
            $xtpl->assign("HEAD", $array_row_i);
            if (defined('NV_IS_MODADMIN')) {
                $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . "&nbsp;-&nbsp;" . nv_link_delete_page($array_row_i['id']));
                $xtpl->parse('main.head_new.adminlink');
            }
            if ($array_row_i['imghome'] != "") {
                if (file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['imghome'])) {
                    $size = @getimagesize(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['imghome']);
                    if ($size[0] > 0) {
                        $homewidth = $module_config[$module_name]['homewidth'] * 2;
                        $size[1] = round($homewidth / $size[0] * $size[1]);
                        $size[0] = $homewidth;
                        $xtpl->assign('IMGWIDTH1', $size[0]);
                        $xtpl->assign('IMGHEIGHT1', $size[1]);
                        $xtpl->assign('HOMEIMG1', NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $array_row_i['imghome']);
                        $xtpl->assign('HOMEIMGALT1', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']);
                        $xtpl->parse('main.head_new.image');
                    }
                }
            }
            $xtpl->set_autoreset();
            $xtpl->parse("main.head_new");
        } else {
            $xtpl->assign('CONTENT', $array_row_i);
            if (defined('NV_IS_MODADMIN')) {
                $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . "&nbsp;-&nbsp;" . nv_link_delete_page($array_row_i['id']));
                $xtpl->parse('main.viewcatloop.adminlink');
            }
            if ($array_row_i['imghome'] != "") {
                if (file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['imghome'])) {
                    $size = @getimagesize(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['imghome']);
                    if ($size[0] > 0) {
                        $homewidth = $module_config[$module_name]['homewidth'];
                        $size[1] = round($homewidth / $size[0] * $size[1]);
                        $size[0] = $homewidth;
                        $xtpl->assign('IMGWIDTH1', $size[0]);
                        $xtpl->assign('IMGHEIGHT1', $size[1]);
                        $xtpl->assign('HOMEIMG1', NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $array_row_i['imghome']);
                        $xtpl->assign('HOMEIMGALT1', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']);
                        $xtpl->parse('main.viewcatloop.image');
                    }
                }
            }
            $xtpl->set_autoreset();
            $xtpl->parse('main.viewcatloop');
        }
        $a++;
    }
    if (!empty($array_cat_other)) {
        $xtpl->assign('ORTHERNEWS', $lang_module['other']);
        foreach ($array_cat_other as $array_row_i) {
            $array_row_i['publtime'] = nv_date("d/m/Y", $array_row_i['publtime']);
            $xtpl->assign('RELATED', $array_row_i);
            $xtpl->parse('main.related.loop');
        }
        $xtpl->parse('main.related');
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
开发者ID:syphuonglam,项目名称:creative-portal,代码行数:70,代码来源:theme.php

示例10: viewsubcat_main

function viewsubcat_main($viewcat, $array_cat)
{
    global $module_name, $module_file, $global_array_cat, $lang_module, $module_config, $module_info, $global_config;
    $xtpl = new XTemplate($viewcat . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('TEMPLATE', $global_config['module_theme']);
    // Hien thi cac chu de con
    foreach ($array_cat as $key => $array_row_i) {
        if (isset($array_cat[$key]['content'])) {
            $array_row_i['rss'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $module_info['alias']['rss'] . "/" . $array_row_i['alias'];
            $xtpl->assign('CAT', $array_row_i);
            $catid = intval($array_row_i['catid']);
            if ($array_row_i['subcatid'] != '') {
                $exl = 0;
                $arrsubcat_s = explode(',', $array_row_i['subcatid']);
                foreach ($arrsubcat_s as $subcatid_i) {
                    if ($global_array_cat[$subcatid_i]['inhome'] == 1) {
                        $xtpl->clear_autoreset();
                        if ($exl < 3) {
                            $xtpl->assign('SUBCAT', $global_array_cat[$subcatid_i]);
                            $xtpl->parse('main.listcat.subcatloop');
                            $xtpl->set_autoreset();
                        } else {
                            $more = array('title' => $lang_module['more'], 'link' => $global_array_cat[$catid]['link']);
                            $xtpl->assign('MORE', $more);
                            $xtpl->parse('main.listcat.subcatmore');
                            $xtpl->set_autoreset();
                            break;
                        }
                        ++$exl;
                    }
                }
            }
            $a = 0;
            $xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']);
            foreach ($array_cat[$key]['content'] as $array_row_i) {
                $newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday'];
                $array_row_i['publtime'] = nv_date('d/m/Y h:i:s A', $array_row_i['publtime']);
                $array_row_i['hometext'] = nv_clean60($array_row_i['hometext'], 90);
                $array_row_i['title0'] = nv_clean60($array_row_i['title'], 40);
                ++$a;
                if ($a == 1) {
                    $image = NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['homeimgfile'];
                    if ($array_row_i['homeimgfile'] != '' and file_exists($image)) {
                        $width = 370;
                        $height = 200;
                        $array_row_i['imghome'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $array_row_i['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 . '_' . $array_row_i['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename);
                            if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
                                $array_row_i['imghome'] = 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)) {
                                    $array_row_i['imghome'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
                                }
                            }
                        }
                    }
                    if ($newday >= NV_CURRENTTIME) {
                        $xtpl->parse('main.listcat.newday');
                    }
                    $xtpl->assign('CONTENT', $array_row_i);
                    if ($array_row_i['imghome'] != "") {
                        $xtpl->assign('HOMEIMG', $array_row_i['imghome']);
                        $xtpl->assign('HOMEIMGALT', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']);
                        $xtpl->parse('main.listcat.image');
                    }
                    if (defined('NV_IS_MODADMIN')) {
                        $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " " . nv_link_delete_page($array_row_i['id']));
                        $xtpl->parse('main.listcat.adminlink');
                    }
                } else {
                    if ($newday >= NV_CURRENTTIME) {
                        $xtpl->assign('CLASS', 'icon_new_small');
                    } else {
                        $xtpl->assign('CLASS', 'icon_list');
                    }
                    $array_row_i['title0'] = nv_clean60($array_row_i['title'], 35);
                    $array_row_i['hometext'] = nv_clean60($array_row_i['hometext'], 90);
                    $xtpl->assign('OTHER', $array_row_i);
                    $xtpl->parse('main.listcat.related.loop');
                }
                if ($a > 1) {
                    $xtpl->assign('WCT', 'col-md-8 ');
                } else {
                    $xtpl->assign('WCT', '');
                }
                $xtpl->set_autoreset();
            }
            if ($a > 1) {
                $xtpl->parse('main.listcat.related');
            }
            $xtpl->parse('main.listcat');
        }
//.........这里部分代码省略.........
开发者ID:hongoctrien,项目名称:themes-newszine,代码行数:101,代码来源:theme.php

示例11: viewsubcat_main

function viewsubcat_main($viewcat, $array_cat)
{
    global $module_name, $module_file, $site_mods, $global_array_cat, $lang_module, $module_config, $module_info;
    $xtpl = new XTemplate($viewcat . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('TOOLTIP_POSITION', $module_config[$module_name]['tooltip_position']);
    $xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']);
    // Hien thi cac chu de con
    foreach ($array_cat as $key => $array_row_i) {
        if (isset($array_cat[$key]['content'])) {
            $array_row_i['rss'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=" . $module_info['alias']['rss'] . "/" . $array_row_i['alias'];
            $xtpl->assign('CAT', $array_row_i);
            $catid = intval($array_row_i['catid']);
            $array_row_i['ad_block_cat'] = explode(',', $array_row_i['ad_block_cat']);
            $_block_topcat_by_id = '[' . strtoupper($module_name) . '_TOPCAT_' . $array_row_i['catid'] . ']';
            if (in_array('1', $array_row_i['ad_block_cat'])) {
                if (!nv_check_block_topcat_news($array_row_i['catid'])) {
                    nv_add_block_topcat_news($array_row_i['catid']);
                }
                $xtpl->assign('BLOCK_TOPCAT', $_block_topcat_by_id);
                $xtpl->parse('main.listcat.block_topcat');
            } else {
                if (nv_check_block_topcat_news($array_row_i['catid'])) {
                    nv_remove_block_topcat_news($array_row_i['catid']);
                }
            }
            $_block_bottomcat_by_id = '[' . strtoupper($module_name) . '_BOTTOMCAT_' . $array_row_i['catid'] . ']';
            if (in_array('2', $array_row_i['ad_block_cat'])) {
                if (!nv_check_block_block_botcat_news($array_row_i['catid'])) {
                    nv_add_block_botcat_news($array_row_i['catid']);
                }
                $xtpl->assign('BLOCK_BOTTOMCAT', $_block_bottomcat_by_id);
                $xtpl->parse('main.listcat.block_bottomcat');
            } else {
                if (nv_check_block_block_botcat_news($array_row_i['catid'])) {
                    nv_remove_block_botcat_news($array_row_i['catid']);
                }
            }
            if ($array_row_i['subcatid'] != '') {
                $_arr_subcat = explode(',', $array_row_i['subcatid']);
                $limit = 0;
                foreach ($_arr_subcat as $catid_i) {
                    if ($global_array_cat[$catid_i]['inhome'] == 1) {
                        $xtpl->assign('SUBCAT', $global_array_cat[$catid_i]);
                        $xtpl->parse('main.listcat.subcatloop');
                        $limit++;
                    }
                    if ($limit >= 3) {
                        $more = array('title' => $lang_module['more'], 'link' => $global_array_cat[$catid]['link']);
                        $xtpl->assign('MORE', $more);
                        $xtpl->parse('main.listcat.subcatmore');
                        break;
                    }
                }
            }
            $a = 0;
            foreach ($array_cat[$key]['content'] as $array_row_i) {
                $newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday'];
                $array_row_i['publtime'] = nv_date('d/m/Y H:i', $array_row_i['publtime']);
                ++$a;
                if ($a == 1) {
                    if ($newday >= NV_CURRENTTIME) {
                        $xtpl->parse('main.listcat.newday');
                    }
                    $xtpl->assign('CONTENT', $array_row_i);
                    if ($array_row_i['imghome'] != "") {
                        $xtpl->assign('HOMEIMG', $array_row_i['imghome']);
                        $xtpl->assign('HOMEIMGALT', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']);
                        $xtpl->parse('main.listcat.image');
                    }
                    if (defined('NV_IS_MODADMIN')) {
                        $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " " . nv_link_delete_page($array_row_i['id']));
                        $xtpl->parse('main.listcat.adminlink');
                    }
                } else {
                    if ($newday >= NV_CURRENTTIME) {
                        $xtpl->assign('CLASS', 'icon_new_small');
                    } else {
                        $xtpl->assign('CLASS', 'icon_list');
                    }
                    $array_row_i['hometext'] = nv_clean60($array_row_i['hometext'], $module_config[$module_name]['tooltip_length'], true);
                    $xtpl->assign('OTHER', $array_row_i);
                    if ($module_config[$module_name]['showtooltip']) {
                        $xtpl->parse('main.listcat.related.loop.tooltip');
                    }
                    $xtpl->parse('main.listcat.related.loop');
                }
                if ($a > 1) {
                    $xtpl->assign('WCT', 'col-md-16 ');
                } else {
                    $xtpl->assign('WCT', 'col-md-24');
                }
                $xtpl->set_autoreset();
            }
            if ($a > 1) {
                $xtpl->parse('main.listcat.related');
            }
            if (isset($site_mods['comment']) and isset($module_config[$module_name]['activecomm']) and $module_config[$module_name]['activecomm']) {
                $xtpl->parse('main.listcat.comment');
            }
//.........这里部分代码省略.........
开发者ID:nukeviet,项目名称:nukeviet,代码行数:101,代码来源:theme.php


注:本文中的XTemplate::set_autoreset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。