Exemplo n.º 1
0
 /**
  * 专题首页
  */
 public function init()
 {
     $specialid = $_GET['id'] ? intval($_GET['id']) : ($_GET['specialid'] ? intval($_GET['specialid']) : 0);
     if (!$specialid) {
         showmessage(L('illegal_action'));
     }
     $info = $this->db->get_one(array('id' => $specialid, 'disabled' => 0));
     if (!$info) {
         showmessage(L('special_not_exist'), 'back');
     }
     extract($info);
     $css = get_css(unserialize($css));
     if (!$ispage) {
         $type_db = pc_base::load_model('type_model');
         $types = $type_db->select(array('module' => 'special', 'parentid' => $specialid), '*', '', '`listorder` ASC, `typeid` ASC', '', 'listorder');
     }
     if ($pics) {
         $pic_data = get_pic_content($pics);
         unset($pics);
     }
     if ($voteid) {
         $vote_info = explode('|', $voteid);
         $voteid = $vote_info[1];
     }
     $siteid = $_GET['siteid'] ? $_GET['siteid'] : get_siteid();
     $SEO = seo($siteid, '', $title, $description);
     $commentid = id_encode('special', $id, $siteid);
     $template = $info['index_template'] ? $info['index_template'] : 'index';
     define('STYLE', $info['style']);
     include template('special', $template);
 }
Exemplo n.º 2
0
 /**
  * 专题首页
  */
 public function init()
 {
     $specialid = $_GET['id'] ? $_GET['id'] : ($_GET['specialid'] ? $_GET['specialid'] : 0);
     if (!$specialid) {
         showmessage(L('illegal_action'));
     }
     $info = $this->db->where(array('id' => $specialid, 'disabled' => 0))->find();
     if (!$info) {
         showmessage(L('special_not_exist'), 'back');
     }
     extract($info);
     $css = get_css(unserialize($css));
     if (!$ispage) {
         $type_db = Loader::model('type_model');
         $types = $type_db->where(array('application' => 'special', 'parentid' => $specialid))->order('listorder ASC, typeid ASC')->key('listorder')->select();
     }
     if ($pics) {
         $pic_data = get_pic_content($pics);
         unset($pics);
     }
     if ($voteid) {
         $vote_info = explode('|', $voteid);
         $voteid = $vote_info[1];
     }
     $SEO = seo('', $title, $description);
     $commentid = id_encode('special', $id);
     $template = $info['index_template'] ? $info['index_template'] : 'index';
     include template('special', $template);
 }
Exemplo n.º 3
0
 /**
  * 生成专题首页
  * @param intval $specialid 专题ID
  * @param intval $pagesize 每页个数
  * @param intval $pages_num 最大更新页数
  * @return boolen/intval 成功返回生成文件的大小
  */
 public function _index($specialid = 0, $pagesize = 20, $pages_num = 0)
 {
     pc_base::load_app_func('global', 'special');
     $specialid = intval($specialid);
     if (!$specialid) {
         return false;
     }
     $r = $this->db->get_one(array('id' => $specialid, 'siteid' => get_siteid()));
     if (!$r['ishtml'] || $r['disabled'] != 0) {
         return true;
     }
     if (!$specialid) {
         showmessage(L('illegal_action'));
     }
     $info = $this->db->get_one(array('id' => $specialid));
     if (!$info) {
         showmessage(L('special_not_exist'), 'back');
     }
     extract($info);
     if ($pics) {
         $pic_data = get_pic_content($pics);
         unset($pics);
     }
     if ($voteid) {
         $vote_info = explode('|', $voteid);
         $voteid = $vote_info[1];
     }
     $commentid = id_encode('special', $id, $siteid);
     //分站时计算路径
     if ($siteid > 1) {
         $site_info = $this->site->get_by_id($siteid);
         $file = pc_base::load_config('system', 'html_root') . '/' . $site_info['dirname'] . '/special/' . $filename . '/index.html';
     } else {
         $file = pc_base::load_config('system', 'html_root') . '/special/' . $filename . '/index.html';
     }
     if (!$ispage) {
         $type_db = pc_base::load_model('type_model');
         $types = $type_db->select(array('module' => 'special', 'parentid' => $specialid), '*', '', '`listorder` ASC, `typeid` ASC', '', 'listorder');
     }
     $css = get_css(unserialize($css));
     $template = $index_template ? $index_template : 'index';
     $SEO = seo($siteid, '', $title, $description);
     if ($ispage) {
         $re = $this->c_db->get_one(array('specialid' => $specialid), 'COUNT(`id`) AS num');
         $total = $re['num'];
         $times = ceil($total / $pagesize);
         if ($pages_num) {
             $pages_num = min($times, $pages_num);
         } else {
             $pages_num = $times;
         }
         for ($i = 1; $i <= $pages_num; $i++) {
             if ($i == 1) {
                 $file_root = $file;
             } else {
                 $file_root = str_replace('index', 'index-' . $i, $file);
             }
             $this->queue->add_queue('add', $file_root, $siteid);
             //添加至信息队列
             $file_root = PHPCMS_PATH . $file_root;
             ob_start();
             include template('special', $template);
             $this->create_html($file_root);
         }
         return true;
     } else {
         $this->queue->add_queue('add', $file, $siteid);
         //添加至信息队列
         $file = PHPCMS_PATH . $file;
         ob_start();
         include template('special', $template, $style);
         return $this->create_html($file);
     }
 }
Exemplo n.º 4
0
Arquivo: html.php Projeto: hubs/yuncms
 /**
  * 生成专题首页
  *
  * @param intval $specialid
  *        	专题ID
  * @param intval $pagesize
  *        	每页个数
  * @param intval $pages_num
  *        	最大更新页数
  * @return boolen/intval 成功返回生成文件的大小
  */
 public function _index($specialid = 0, $pagesize = 20, $pages_num = 0)
 {
     Loader::helper('special:global');
     $specialid = intval($specialid);
     if (!$specialid) {
         return false;
     }
     $r = $this->db->getby_id($specialid);
     if (!$r['ishtml'] || $r['disabled'] != 0) {
         return true;
     }
     if (!$specialid) {
         showmessage(L('illegal_action'));
     }
     $info = $this->db->getby_id($specialid);
     if (!$info) {
         showmessage(L('special_not_exist'), 'back');
     }
     extract($info);
     if ($pics) {
         $pic_data = get_pic_content($pics);
         unset($pics);
     }
     if ($voteid) {
         $vote_info = explode('|', $voteid);
         $voteid = $vote_info[1];
     }
     $commentid = id_encode('special', $id);
     $file = $this->html_root . '/special/' . $filename . '/index.html';
     if (!$ispage) {
         $type_db = Loader::model('type_model');
         $types = $type_db->where(array('application' => 'special', 'parentid' => $specialid))->order('listorder ASC, typeid ASC')->key('listorder')->select();
     }
     $css = get_css(unserialize($css));
     $template = $index_template ? $index_template : 'index';
     $SEO = seo('', $title, $description);
     if ($ispage) {
         $total = $this->c_db->where(array('specialid' => $specialid))->count();
         $times = ceil($total / $pagesize);
         if ($pages_num) {
             $pages_num = min($times, $pages_num);
         } else {
             $pages_num = $times;
         }
         for ($i = 1; $i <= $pages_num; $i++) {
             if ($i == 1) {
                 $file_root = $file;
             } else {
                 $file_root = str_replace('index', 'index-' . $i, $file);
             }
             $file_root = BASE_PATH . $file_root;
             ob_start();
             include template('special', $template);
             $this->create_html($file_root);
         }
         return true;
     } else {
         $file = BASE_PATH . $file;
         ob_start();
         include template('special', $template, $style);
         return $this->create_html($file);
     }
 }