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


PHP cmsPage::initTemplate方法代码示例

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


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

示例1: mod_category

function mod_category($mod, $cfg) {
    $cfg = array_merge(
        array(
            'category_id'  => 0,
            'show_subcats' => 1,
            'expand_all'   => 1
        ),
        $cfg
    );
    
    $rootcat = cmsCore::c('db')->getNsCategory('cms_category', $cfg['category_id']);
    if (!$rootcat) { return false; }

    $subcats_list = cmsCore::m('content')->getSubCats($rootcat['id'], $cfg['show_subcats'], $rootcat['NSLeft'], $rootcat['NSRight']);
    
    if (!$subcats_list) { return false; }

    $current_seolink = urldecode(cmsCore::request('seolink', 'str', ''));

    cmsPage::initTemplate('modules', $cfg['tpl'])->
        assign('cfg', $cfg)->
        assign('current_seolink', $current_seolink)->
        assign('subcats_list', $subcats_list)->
        display();

    return true;
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:27,代码来源:module.php

示例2: mod_dt_newsslider

function mod_dt_newsslider($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    if (!isset($cfg['cat_id'])) {
        $cfg['cat_id'] = 1;
    }
    if ($cfg['cat_id']) {
        if (!$cfg['subs']) {
            $model->whereCatIs($cfg['cat_id']);
        } else {
            $rootcat = $inDB->getNsCategory('cms_category', $cfg['cat_id']);
            if (!$rootcat) {
                return false;
            }
            $model->whereThisAndNestedCats($rootcat['NSLeft'], $rootcat['NSRight']);
        }
    }
    $inDB->orderBy('con.ordering', 'ASC');
    $inDB->limit($cfg['newscount']);
    $slider_list = $model->getArticlesList();
    if (!$slider_list) {
        return false;
    }
    cmsPage::initTemplate('modules', 'mod_dt_newsslider')->assign('slider', $slider_list)->assign('cfg', $cfg)->assign('module_id', $module_id)->display('mod_dt_newsslider.tpl');
    return true;
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:28,代码来源:module.php

示例3: mod_blogs

function mod_blogs($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $default_cfg = array('sort' => 'pubdate', 'owner' => 'user', 'shownum' => 5, 'minrate' => 0, 'blog_id' => 0, 'showrss' => 1);
    $cfg = array_merge($default_cfg, $cfg);
    cmsCore::loadClass('blog');
    $inBlog = cmsBlogs::getInstance();
    $inBlog->owner = $cfg['owner'];
    if ($cfg['owner'] == 'club') {
        cmsCore::loadModel('clubs');
        $model = new cms_model_clubs();
        $inDB->addSelect('b.user_id as bloglink');
    } else {
        cmsCore::loadModel('blogs');
        $model = new cms_model_blogs();
    }
    // получаем аватары владельцев
    $inDB->addSelect('up.imageurl');
    $inDB->addJoin('LEFT JOIN cms_user_profiles up ON up.user_id = u.id');
    $inBlog->whereOnlyPublic();
    if ($cfg['minrate']) {
        $inBlog->ratingGreaterThan($cfg['minrate']);
    }
    if ($cfg['blog_id']) {
        $inBlog->whereBlogIs($cfg['blog_id']);
    }
    $inDB->orderBy('p.' . $cfg['sort'], 'DESC');
    $inDB->limit($cfg['shownum']);
    $posts = $inBlog->getPosts(false, $model);
    if (!$posts) {
        return false;
    }
    cmsPage::initTemplate('modules', 'mod_blogs')->assign('posts', $posts)->assign('cfg', $cfg)->display('mod_blogs.tpl');
    return true;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:35,代码来源:module.php

示例4: mod_bestcontent

function mod_bestcontent($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    if (!isset($cfg['shownum'])) {
        $cfg['shownum'] = 5;
    }
    if (!isset($cfg['subs'])) {
        $cfg['subs'] = 1;
    }
    if (!isset($cfg['cat_id'])) {
        $cfg['cat_id'] = 1;
    }
    $inDB->where("con.canrate = 1");
    if ($cfg['cat_id']) {
        if (!$cfg['subs']) {
            //выбираем из категории
            $model->whereCatIs($cfg['cat_id']);
        } else {
            //выбираем из категории и подкатегорий
            $rootcat = $inDB->getNsCategory('cms_category', $cfg['cat_id']);
            if (!$rootcat) {
                return false;
            }
            $model->whereThisAndNestedCats($rootcat['NSLeft'], $rootcat['NSRight']);
        }
    }
    $inDB->orderBy('con.rating', 'DESC');
    $inDB->limitPage(1, $cfg['shownum']);
    $content_list = $model->getArticlesList();
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('articles', $content_list)->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:34,代码来源:module.php

示例5: mod_clubs

function mod_clubs($mod, $cfg) {
    $cfg = array_merge(array(
        'count'      => 5,
        'type'       => 'id',
        'vip_on_top' => 1
    ), $cfg);

    if ($cfg['vip_on_top']) {
        cmsCore::c('db')->orderBy('is_vip', 'DESC, c.'. $cfg['type'] .' DESC');
    } else {
        cmsCore::c('db')->orderBy('c.'. $cfg['type'], 'DESC');
    }
    
    cmsCore::c('db')->limit($cfg['count']);

    $clubs = cmsCore::m('clubs')->getClubs();
    
    if (!$clubs) { return false; }

    cmsPage::initTemplate('modules', $cfg['tpl'])->
        assign('clubs', $clubs)->
        display();

    return true;
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:25,代码来源:module.php

示例6: mod_user_image

function mod_user_image($mod, $cfg) {
    $sql = "SELECT u.id uid, u.nickname author, u.login as login, p.imageurl, p.title, p.id, pr.gender gender
            FROM cms_user_photos p
            LEFT JOIN cms_users u ON u.id = p.user_id
            LEFT JOIN cms_user_profiles pr ON pr.user_id = u.id
            LEFT JOIN cms_user_albums a ON a.id = p.album_id
            WHERE p.allow_who = 'all' AND u.is_deleted = 0 AND u.is_locked = 0
                  AND p.album_id > 0 AND a.allow_who = 'all'
            ORDER BY RAND()
            LIMIT 1";

    $result = cmsCore::c('db')->query($sql) ;

    if (!cmsCore::c('db')->num_rows($result)) { return false; }

    while ($usr = cmsCore::c('db')->fetch_assoc($result)) {
        $usr['genderlink'] = cmsUser::getGenderLink($usr['uid'], $usr['author'], $usr['gender'], $usr['login']);
        $users[] = $usr;
    }

    cmsPage::initTemplate('modules', $cfg['tpl'])->
        assign('users', $users)->
        assign('cfg', $cfg)->
        display();

    return true;
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:27,代码来源:module.php

示例7: mod_category

function mod_category($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    if (!isset($cfg['category_id'])) {
        $cfg['category_id'] = 0;
    }
    if (!isset($cfg['show_subcats'])) {
        $cfg['show_subcats'] = 1;
    }
    if (!isset($cfg['expand_all'])) {
        $cfg['expand_all'] = 1;
    }
    $rootcat = $inDB->getNsCategory('cms_category', $cfg['category_id']);
    if (!$rootcat) {
        return false;
    }
    $subcats_list = $model->getSubCats($rootcat['id'], $cfg['show_subcats'], $rootcat['NSLeft'], $rootcat['NSRight']);
    if (!$subcats_list) {
        return false;
    }
    $current_seolink = urldecode(cmsCore::request('seolink', 'str', ''));
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('cfg', $cfg)->assign('current_seolink', $current_seolink)->assign('subcats_list', $subcats_list)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:26,代码来源:module.php

示例8: mod_pogoda_current

function mod_pogoda_current($mod, $cfg)
{
    $inCore = cmsCore::getInstance();
    //Загрузка настроек компонента
    $component = $inCore->loadComponentConfig('pogoda');
    $component["name_en"] = $component["name_en"] ? $component["name_en"] . '_' : '';
    // Проверяем включен ли компонент и установлен ли city_id
    if (!$component['component_enabled'] || !$component['city_id']) {
        return false;
    }
    cmsCore::loadModel('pogoda');
    $model = new cms_model_pogoda();
    $model->setTable('current');
    $dbWeather = $model->getWeather();
    $xml = simplexml_load_string($dbWeather["xml"]);
    if (!$xml) {
        return true;
    }
    $current = array();
    $current["temperature"] = round($xml->temperature["value"]) . ' °C';
    $current["weather"]["value"] = $xml->weather["value"];
    $current["weather"]["icon"] = $xml->weather["icon"];
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('current', $current)->display($cfg['tpl']);
    return true;
}
开发者ID:roman-burachenko,项目名称:icms1_com_pogoda,代码行数:25,代码来源:module.php

示例9: mod_actions

function mod_actions(array $mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $inActions = cmsActions::getInstance();
    global $_LANG;
    if (!isset($cfg['show_target'])) {
        $cfg['show_target'] = 1;
    }
    if (!isset($cfg['limit'])) {
        $cfg['limit'] = 15;
    }
    if (!isset($cfg['show_link'])) {
        $cfg['show_link'] = 1;
    }
    if (!isset($cfg['action_types'])) {
        echo $_LANG['MODULE_NOT_CONFIGURED'];
        return true;
    }
    if (!$cfg['show_target']) {
        $inActions->showTargets(false);
    }
    $inActions->onlySelectedTypes($cfg['action_types']);
    $inDB->limitIs($cfg['limit']);
    $actions = $inActions->getActionsLog();
    if (!$actions) {
        return false;
    }
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('actions', $actions)->assign('cfg', $cfg)->assign('user_id', cmsUser::getInstance()->id)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:30,代码来源:module.php

示例10: mod_actions

function mod_actions($mod, $cfg) {
    global $_LANG;
    
    if (!isset($cfg['action_types'])) {
        echo $_LANG['MODULE_NOT_CONFIGURED'];
        return true;
    }
    
    $cfg = array_merge(
        array(
            'show_target' => 1,
            'limit' => 15,
            'show_link' => 1
        ),
        $cfg
    );
    
    if (!$cfg['show_target']) {
        cmsCore::c('actions')->showTargets(false);
    }

    cmsCore::c('actions')->onlySelectedTypes($cfg['action_types']);
    cmsCore::c('db')->limitIs($cfg['limit']);
    
    $actions = cmsCore::c('actions')->getActionsLog();
    if (!$actions) { return false; }

    cmsPage::initTemplate('modules', $cfg['tpl'])->
        assign('actions', $actions)->
        assign('cfg', $cfg)->
        assign('user_id', cmsCore::c('user')->id)->
        display();

    return true;
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:35,代码来源:module.php

示例11: mod_user_friend

function mod_user_friend($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    if (!$inUser->id) {
        return false;
    }
    if ($cfg['view_type'] == 'table') {
        $sql = "SELECT\r\n                CASE\r\n                WHEN f.from_id = {$inUser->id}\r\n                THEN f.to_id\r\n                WHEN f.to_id = {$inUser->id}\r\n                THEN f.from_id\r\n                END AS user_id, u.login, u.nickname, u.is_deleted, p.imageurl\r\n                FROM cms_user_friends f\r\n                INNER JOIN cms_online o ON o.user_id = CASE WHEN f.from_id = {$inUser->id} THEN f.to_id WHEN f.to_id = {$inUser->id} THEN f.from_id END\r\n                LEFT JOIN cms_users u ON u.id = o.user_id\r\n                LEFT JOIN cms_user_profiles p ON p.user_id = u.id\r\n                WHERE (from_id = {$inUser->id} OR to_id = {$inUser->id}) AND is_accepted =1 LIMIT " . $cfg['limit'];
    } else {
        $sql = "SELECT\r\n                CASE\r\n                WHEN f.from_id = {$inUser->id}\r\n                THEN f.to_id\r\n                WHEN f.to_id = {$inUser->id}\r\n                THEN f.from_id\r\n                END AS user_id, u.login, u.nickname\r\n                FROM cms_user_friends f\r\n                INNER JOIN cms_online o ON o.user_id = CASE WHEN f.from_id = {$inUser->id} THEN f.to_id WHEN f.to_id = {$inUser->id} THEN f.from_id END\r\n                LEFT JOIN cms_users u ON u.id = o.user_id\r\n                WHERE (from_id = {$inUser->id} OR to_id = {$inUser->id}) AND is_accepted =1 LIMIT " . $cfg['limit'];
    }
    $result = $inDB->query($sql);
    $total = $inDB->num_rows($result);
    if ($total) {
        $friends = array();
        while ($friend = $inDB->fetch_assoc($result)) {
            $friend['avatar'] = $cfg['view_type'] == 'table' ? cmsUser::getUserAvatarUrl($friend['user_id'], 'small', $friend['imageurl'], $friend['is_deleted']) : false;
            $friend['user_link'] = cmsUser::getProfileLink($friend['login'], $friend['nickname']);
            $friends[$friend['user_id']] = $friend;
        }
    }
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('friends', $friends)->assign('total', $total)->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:25,代码来源:module.php

示例12: mod_whoonline

function mod_whoonline($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    if (!isset($cfg['color_admin'])) {
        $cfg['color_admin'] = '#FF0000';
    }
    if (!isset($cfg['color_editor'])) {
        $cfg['color_editor'] = '#009900';
    }
    $online_count = cmsUser::getOnlineCount();
    $users = array();
    $today_users = array();
    if ($online_count['users']) {
        $sql = "SELECT\n                o.user_id as id,\n                u.login,\n                u.nickname,\n                p.gender as gender\n                FROM cms_online o\n                LEFT JOIN cms_users u ON  u.id = o.user_id\n                LEFT JOIN cms_user_profiles p ON p.user_id = u.id\n                WHERE u.is_locked = 0 AND u.is_deleted = 0\n                GROUP BY o.user_id";
        $result = $inDB->query($sql);
        $users = getUsersArray($result, $cfg, $inDB);
    }
    if ($cfg['show_today']) {
        $today = date("Y-m-d");
        $sql = "SELECT u.id as id, u.nickname as nickname, u.login as login, p.gender as gender\n                FROM cms_users u\n                LEFT JOIN cms_user_profiles p ON p.user_id = u.id\n                WHERE u.is_locked = 0 AND u.is_deleted = 0 AND DATE_FORMAT(u.logdate, '%Y-%m-%d')='{$today}'\n                ORDER BY u.logdate DESC";
        $result = $inDB->query($sql);
        if ($inDB->num_rows($result)) {
            $today_users = getUsersArray($result, $cfg, $inDB);
        }
    }
    cmsPage::initTemplate('modules', 'mod_whoonline')->assign('cfg', $cfg)->assign('users', $users)->assign('guests', $online_count['guests'])->assign('today_users', $today_users)->display('mod_whoonline.tpl');
    return true;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:28,代码来源:module.php

示例13: mod_cart

function mod_cart($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    cmsCore::includeFile('components/catalog/includes/shopcore.php');
    $sid = session_id();
    $items = array();
    $total_summ = 0;
    $user_sql = $inUser->id ? "c.user_id='{$inUser->id}'" : "c.session_id='{$sid}'";
    $sql = "SELECT i.title, i.price, i.category_id, i.id, c.itemscount\n            FROM cms_uc_cart c\n            INNER JOIN cms_uc_items i ON i.id = c.item_id\n            WHERE {$user_sql}";
    $result = $inDB->query($sql);
    $items_count = $inDB->num_rows($result);
    if ($items_count) {
        while ($con = $inDB->fetch_assoc($result)) {
            $price = shopDiscountPrice($con['id'], $con['category_id'], $con['price']);
            $totalcost = $con['itemscount'] * $price;
            $total_summ += $totalcost;
            $con['price'] = number_format($price, 2, '.', ' ');
            $con['totalcost'] = number_format($totalcost, 2, '.', ' ');
            $items[] = $con;
        }
    }
    cmsPage::initTemplate('modules', 'mod_cart')->assign('cfg', $cfg)->assign('items_count', $items_count)->assign('total_summ', number_format($total_summ, 2, '.', ' '))->assign('items', $items)->display('mod_cart.tpl');
    return true;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:25,代码来源:module.php

示例14: mod_latest_faq

function mod_latest_faq($module_id, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    if (!isset($cfg['newscount'])) {
        $cfg['newscount'] = 2;
    }
    if (!isset($cfg['cat_id'])) {
        $cfg['cat_id'] = 0;
    }
    if (!isset($cfg['maxlen'])) {
        $cfg['maxlen'] = 120;
    }
    if ($cfg['cat_id']) {
        $catsql = 'AND category_id = ' . $cfg['cat_id'];
    } else {
        $catsql = '';
    }
    $sql = "SELECT *\n            FROM cms_faq_quests\n            WHERE published = 1 " . $catsql . "\n            ORDER BY pubdate DESC\n            LIMIT " . $cfg['newscount'];
    $result = $inDB->query($sql);
    $faq = array();
    if ($inDB->num_rows($result)) {
        while ($con = $inDB->fetch_assoc($result)) {
            $con['date'] = cmsCore::dateFormat($con['pubdate']);
            $con['href'] = '/faq/quest' . $con['id'] . '.html';
            $faq[] = $con;
        }
    }
    cmsPage::initTemplate('modules', 'mod_latest_faq')->assign('faq', $faq)->assign('cfg', $cfg)->display('mod_latest_faq.tpl');
    return true;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:30,代码来源:module.php

示例15: mod_forum

function mod_forum($mod, $cfg)
{
    $inDB = cmsDatabase::getInstance();
    $default_cfg = array('shownum' => 4, 'cat_id' => 0, 'forum_id' => 0, 'subs' => 0, 'show_hidden' => 0, 'show_pinned' => 0, 'showtext' => 1, 'showforum' => 0, 'order' => 'pubdate');
    $cfg = array_merge($default_cfg, $cfg);
    cmsCore::loadModel('forum');
    $model = new cms_model_forum();
    $inDB->addJoin('INNER JOIN cms_forums f ON f.id = t.forum_id');
    $inDB->addSelect('f.title as forum_title');
    if ($cfg['cat_id']) {
        $model->whereForumCatIs($cfg['cat_id']);
    }
    if ($cfg['forum_id']) {
        if ($cfg['subs']) {
            $forum = $model->getForum($cfg['forum_id']);
            if (!$forum) {
                return false;
            }
            $model->whereThisAndNestedForum($forum['NSLeft'], $forum['NSRight']);
        } else {
            $model->whereForumIs($cfg['forum_id']);
        }
    }
    if (!$cfg['show_hidden']) {
        $model->wherePublicThreads();
    }
    if ($cfg['show_pinned']) {
        $model->wherePinnedThreads();
    }
    $inDB->orderBy('t.' . $cfg['order'], 'DESC');
    $inDB->limit($cfg['shownum']);
    $threads = $model->getThreads();
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('threads', $threads)->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:35,代码来源:module.php


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