Example #1
0
 function Index()
 {
     //print_r($_SESSION);
     //print_r($_COOKIE);
     /**
      * session cookie tourists
      * 
      * 1.判断是登陆,服务器是否保留session
      * 2.如果没有session可取,判断是否本地保存cookie
      * 3.如果session cookie 都没有值可取采用游客登录
      * 
      */
     if (isset($_SESSION['username']) && !empty($_SESSION['username'])) {
         //检测session
         $this->assign('username', $_SESSION['username']);
     } else {
         if (!empty($_COOKIE["username"])) {
             //检测cookie
             $userCookie = $_COOKIE["username"];
             $this->assign('username', $userCookie);
         } else {
             //游客登陆
             $tourists_id = Login::getTouristsId();
             if ($tourists_id == null) {
                 Login::setTouristsId();
             }
         }
     }
     /**
      * 获取顶部banner1数据
      * 
      */
     $index = new Index();
     $banner1 = $index->getBanner1();
     if ($banner1) {
         $this->assign('banner1', $banner1);
     }
     /**
      * 获取banner2数据
      *
      */
     $banner2 = $index->getBanner2();
     if ($banner2) {
         $this->assign('banner2', $banner2);
     }
     /**
      * 获取website数据
      *
      */
     $websites = $index->getWebsites();
     if ($websites) {
         $this->assign('websites', $websites);
     }
 }
 /**
  * productlist基本数据读取
  * @access public
  */
 function productlist()
 {
     /**
      * 获取顶部banner1数据
      *
      */
     $index = new Index();
     $banner1 = $index->getBanner1();
     if ($banner1) {
         $this->assign('banner1', $banner1);
     }
     //	$Productlist = new Productlists();
     //    	//获取目录
     //    	$categoryProductlist = $Productlist->getCategoryProductlist();
     //    	if($categoryProductlist){
     //    		//print_r($categoryProductlist);
     //    		$this->assign('categoryProductlist', $categoryProductlist);
     //    	}
     //获得关键词
     //    	$KEY = get_post_value('key');
     //    	$VALUE = get_post_value('value');
     //    	$order = get_post_value('order');
     //echo $KEY."=>".$VALUE;
     /**
      * 获得产品列表
      * 
      * i.获得一级目录
      *  
      *    显示一级目录推荐
      * 
      * ii.获得二级目录
      * 
      * 	   显示二级目录推荐
      * 
      * iii  获得三级目录
      * 
      *   显示三级目录产品信息 
      */
     //	$productlist = $Productlist->getProductlist();
     //    	if($productlist){
     //    		//print_r($productlist);
     //    		$this->assign('KEY', $KEY);
     //    		$this->assign('VALUE', $VALUE);
     //    		$this->assign('productlist', $productlist);
     //    	}
 }