本文整理匯總了PHP中HomeController::_initialize方法的典型用法代碼示例。如果您正苦於以下問題:PHP HomeController::_initialize方法的具體用法?PHP HomeController::_initialize怎麽用?PHP HomeController::_initialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HomeController
的用法示例。
在下文中一共展示了HomeController::_initialize方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: strtolower
function _initialize()
{
parent::_initialize();
$act = strtolower(ACTION_NAME);
$res['title'] = '圖文素材';
$res['url'] = U('material_lists');
$res['class'] = $act == 'material_lists' ? 'current' : '';
$nav[] = $res;
$res['title'] = '圖片素材';
$res['url'] = U('picture_lists');
$res['class'] = strpos($act, 'picture') !== false ? 'current' : '';
$nav[] = $res;
$res['title'] = '語音素材';
$res['url'] = U('voice_lists');
$res['class'] = strpos($act, 'voice') !== false ? 'current' : '';
$nav[] = $res;
$res['title'] = '視頻素材';
$res['url'] = U('video_lists');
$res['class'] = strpos($act, 'video') !== false ? 'current' : '';
$nav[] = $res;
$res['title'] = '文本素材';
$res['url'] = U('text_lists');
$res['class'] = strpos($act, 'text') !== false ? 'current' : '';
$nav[] = $res;
$this->assign('nav', $nav);
}
示例2: _initialize
public function _initialize()
{
parent::_initialize();
$this->assign('check_all', false);
$this->assign('search_url', U('lists'));
define('ADDON_PUBLIC_PATH', '');
defined('_ADDONS') or define('_ADDONS', MODULE_NAME);
defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME);
defined('_ACTION') or define('_ACTION', ACTION_NAME);
$this->model = M('model')->getByName('public');
$this->assign('model', $this->model);
// dump ( $this->model );
$res['title'] = $this->model['title'];
$res['url'] = U('lists');
$res['class'] = ACTION_NAME != 'help' ? 'current' : '';
$nav[] = $res;
// $res ['title'] = '管理員配置';
// $res ['url'] = U ( 'Home/Admin/lists' );
// $res ['class'] = '';
// $nav [] = $res;
if (ACTION_NAME == 'help') {
$res['title'] = '接口配置幫助';
$res['url'] = U('help', array('public_id' => $_GET['public_id']));
$res['class'] = 'current';
$nav[] = $res;
}
$this->assign('nav', $nav);
}
示例3: _initialize
public function _initialize()
{
parent::_initialize();
$this->Notice = M('notice');
$this->Ndetail = M('noticeDetail');
$this->Youpin = M('youpin');
$this->Ydetail = M('youpinDetail');
}
示例4: _initialize
public function _initialize()
{
parent::_initialize();
$this->assign('check_all', false);
$this->assign('search_url', U('lists'));
define('ADDON_PUBLIC_PATH', '');
defined('_ADDONS') or define('_ADDONS', MODULE_NAME);
defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME);
defined('_ACTION') or define('_ACTION', ACTION_NAME);
$this->model = M('model')->getByName('public');
$this->assign('model', $this->model);
// dump ( $this->model );
}
示例5: _initialize
protected function _initialize()
{
parent::_initialize();
/**
* 獲取登錄者用戶的信息
*/
$map = array();
$map['uid'] = session('user_auth')['uid'];
$user = M('User')->where($map)->find();
//獲取共有幾個相冊
$user['album_num'] = M('Album')->where($map)->count();
//獲取共有幾張照片
$album_ids = M('Album')->where($map)->getField('id', true);
if ($album_ids) {
$map1 = array();
$map1['album_id'] = array('in', $album_ids);
$user['pic_num'] = M('Pic')->where($map1)->count();
} else {
$user['pic_num'] = 0;
}
//獲取收藏
$user['collect_num'] = M('Collect')->where($map)->count();
$this->assign('user', $user);
/**
* 獲取相冊列表
*/
$Album = M('Album');
$map = array();
$map['a.uid'] = session('user_auth')['uid'];
$album_list = $Album->alias('a')->join('__PIC__ p on a.cover_id = p.id', 'left')->field('a.*,p.path')->where($map)->select();
$Pic = M('Pic');
$Thumb = M('Thumb');
foreach ($album_list as $key => $val) {
//獲取相冊的圖片數量
$map = array();
$map['album_id'] = $val['id'];
$album_list[$key]['number'] = $Pic->where($map)->count();
//如果沒有設置封麵,則獲取相冊的第一章圖片為封麵
if (empty($val['cover_id'])) {
$cover_id = $Pic->where($map)->getField('id');
} else {
$cover_id = $val['cover_id'];
}
//獲取封麵圖片的路徑 --- 相冊封麵要足夠清晰,這裏不使用縮略圖
$map = array();
$map['id'] = $cover_id;
$album_list[$key]['cover'] = $Thumb->where($map)->getField('path');
}
$this->assign('album_list', $album_list);
}
示例6: _initialize
public function _initialize($userid)
{
parent::_initialize();
// header("Cache-control:no-cache,no-store,must-revalidate");
//header("Pragma:no-cache");
// header("Expires:0");
//C('HTTP_CACHE_CONTROL','no-cache, no-store');
//dump($_SERVER);
$userid = I('uid', $_SESSION['cs_home']['user_auth']['uid'], 'int');
//判斷進入個人中心的是誰,兩種情況,一種沒有參數,直接訪問,可以訪問自己的個人中心,帶參數則是訪問別人的個人中心
//如果訪問別人的個人中心,是可以訪問的,但是不能發給對方發私信,在消息哪裏提示登錄
if ($_SESSION['cs_home']['user_auth']['uid'] < 1) {
$this->error('你還未登錄,請登錄後重試!', U('User/login'));
}
if ($userid == 0 || $_SESSION['cs_home']['user_auth']['uid'] == $userid) {
$cxuid = $_SESSION['cs_home']['user_auth']['uid'];
$ucenter = true;
$userart = '5,2,1';
} else {
$cxuid = $userid;
$ucenter = false;
$userart = '1';
}
$cxuser = query_user(array('pos_province', 'pos_community', 'pos_city', 'pos_district', 'zan', 'fensi', 'focusnum', 'scartnum', 'tagfocusnum', 'supportnum', 'score', 'signature', 'commentnum', 'artnum', 'allartnum', 'email', 'uid', 'username', 'nickname', 'name', 'login', 'reg_time', 'space_url', 'last_login_time', 'avatar32', 'avatar64', 'avatar128', 'avatar256'), $cxuid);
$hasfocususer = hasguanzhu($cxuid, $_SESSION['cs_home']['user_auth']['uid'], 0);
$this->assign('hasfocususer', $hasfocususer);
$map['uid'] = $cxuid;
$map['status'] = 1;
$map['tag'] = array('neq', 'null');
$tagarr = array_filter(M('article')->where($map)->getField('tag', true));
if ($tagarr != null) {
$taglist = implode(',', $tagarr);
$taglistcache = explode(',', $taglist);
$taglistcache = array_unique($taglistcache);
foreach ($taglistcache as $key => $vo) {
$usertaglist[$key] = gettaginfobytitle($vo);
}
}
$usertaglist = array_filter($usertaglist);
$this->assign('usertaglist', $usertaglist);
timetonow();
$this->assign('cxuid', $cxuid);
$this->assign('ucenter', $ucenter);
$this->assign('cxuser', $cxuser);
$this->assign('userid', $userid);
$this->assign('webdescription', '用戶中心');
$this->assign('webkeyword', '用戶中心');
$this->assign('webtitle', '用戶中心');
}
示例7: strtolower
function _initialize()
{
parent::_initialize();
$act = strtolower(ACTION_NAME);
$res['title'] = '高級群發';
$res['url'] = U('add');
$res['class'] = $act == 'add' ? 'current' : '';
$nav[] = $res;
$res['title'] = '客服群發';
$res['url'] = U('custom_sendall');
$res['class'] = $act == 'custom_sendall' ? 'current' : '';
$nav[] = $res;
$res['title'] = '消息管理';
$res['url'] = U('message_lists');
$res['class'] = $act == 'message_lists' ? 'current' : '';
$nav[] = $res;
$this->assign('nav', $nav);
}
示例8: _initialize
public function _initialize()
{
parent::_initialize();
if (!session('userDetail')) {
$this->error("非法訪問!", U('Index/index'));
} else {
$this->userDetail = $userDetail = session('userDetail');
$this->user_id = $userDetail[0]['user_id'];
}
//輸出用戶基本信息
$this->assign("userBase", $this->userBase);
//根據當前時間,顯示問候語
date_default_timezone_set('Asia/Shanghai');
$h = date("H");
if ($h < 11) {
$hello = "早上好!";
} else {
if ($h < 13) {
$hello = "中午好!";
} else {
if ($h < 17) {
$hello = "下午好!";
} else {
$hello = "晚上好!";
}
}
}
$this->assign("hello", $hello);
//判斷用戶名長度,對用戶名進行截取
$length_nickname = strlen($this->userBase[nick_name]);
if ($length_nickname > 6) {
$nickname = substr($this->userBase[nick_name], 0, 6) . "···";
$this->assign("nickname", $nickname);
} else {
$this->assign("nickname", $this->userBase[nick_name]);
}
//我的項目數
$Project = M("ProjectBase");
$pro_count = $Project->where("user_id = '{$this->user_id}'")->count();
$this->assign("pro_count", $pro_count);
}
示例9: _initialize
public function _initialize()
{
parent::_initialize();
$this->assign('check_all', false);
$this->assign('search_url', U('lists'));
define('ADDON_PUBLIC_PATH', '');
defined('_ADDONS') or define('_ADDONS', MODULE_NAME);
defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME);
defined('_ACTION') or define('_ACTION', ACTION_NAME);
$this->model = M('Model')->getByName('member_public');
$this->assign('model', $this->model);
// dump ( $this->model );
$res['title'] = $this->model['title'];
$res['url'] = U('lists');
$res['class'] = ACTION_NAME != 'help' ? 'current' : '';
$nav[] = $res;
$res['title'] = '接口配置幫助';
$res['url'] = U('help');
$res['class'] = ACTION_NAME == 'help' ? 'current' : '';
$nav[] = $res;
$this->assign('nav', $nav);
}
示例10: _initialize
public function _initialize()
{
parent::_initialize();
$this->assign('check_all', false);
$this->assign('search_url', U('lists'));
define('ADDON_PUBLIC_PATH', '');
defined('_ADDONS') or define('_ADDONS', MODULE_NAME);
defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME);
defined('_ACTION') or define('_ACTION', ACTION_NAME);
$this->model = M('model')->getByName('user');
$this->assign('model', $this->model);
// dump ( $this->model );
$res['title'] = '公眾號管理';
$res['url'] = U('Home/Public/lists');
$res['class'] = '';
$nav[] = $res;
$res['title'] = '管理員配置';
$res['url'] = U('Home/Admin/lists');
$res['class'] = 'current';
$nav[] = $res;
$this->assign('nav', $nav);
}
示例11: strtolower
function _initialize()
{
parent::_initialize();
$act = strtolower(ACTION_NAME);
$controller = strtolower(CONTROLLER_NAME);
$res['title'] = '用戶列表';
$res['url'] = U('Home/UserCenter/lists');
$res['class'] = $controller == 'usercenter' ? 'current' : '';
$nav[] = $res;
$res['title'] = '用戶分組';
$res['url'] = U('Home/AuthGroup/lists');
$res['class'] = $controller == 'authgroup' ? 'current' : '';
$nav[] = $res;
$res['title'] = '用戶積分';
$res['url'] = U('Home/CreditData/lists');
$res['class'] = $controller == 'creditdata' || $controller == 'creditconfig' ? 'current' : '';
$nav[] = $res;
$res['title'] = '基礎配置';
$res['url'] = addons_url('UserCenter://UserCenter/config');
$res['class'] = $controller == 'usecnter' ? 'current' : '';
$nav[] = $res;
$this->assign('nav', $nav);
$this->syc_wechat = C('USER_LIST');
}
示例12: _initialize
/**
* 初始化方法
* @author jry <598821125@qq.com>
*/
protected function _initialize()
{
parent::_initialize();
$this->is_login();
}
示例13: _initialize
public function _initialize()
{
parent::_initialize();
}