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


PHP content_pages函数代码示例

本文整理汇总了PHP中content_pages函数的典型用法代码示例。如果您正苦于以下问题:PHP content_pages函数的具体用法?PHP content_pages怎么用?PHP content_pages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: show


//.........这里部分代码省略.........
         }
         // 检查是否支付过
         $allow_visitor = self::_check_payment($catid . '_' . $id, $paytype);
         if (!$allow_visitor) {
             $http_referer = urlencode(Base_Request::get_url());
             $allow_visitor = String::authcode($catid . '_' . $id . '|' . $readpoint . '|' . $paytype) . '&http_referer=' . $http_referer;
         } else {
             $allow_visitor = 1;
         }
     }
     // 最顶级栏目ID
     $arrparentid = explode(',', $CAT['arrparentid']);
     $top_parentid = isset($arrparentid[1]) ? $arrparentid[1] : $catid;
     $template = $template ? $template : $CAT['setting']['show_template'];
     if (!$template) {
         $template = 'show';
     }
     // SEO
     $seo_keywords = '';
     if (!empty($keywords)) {
         $seo_keywords = implode(',', $keywords);
     }
     $SEO = seo($catid, $title, $description, $seo_keywords);
     define('STYLE', $CAT['setting']['template_list']);
     if (isset($rs['paginationtype'])) {
         $paginationtype = $rs['paginationtype'];
         $maxcharperpage = $rs['maxcharperpage'];
     }
     $pages = $titles = '';
     if ($rs['paginationtype'] == 1) {
         // 自动分页
         if ($maxcharperpage < 10) {
             $maxcharperpage = 500;
         }
         $contentpage = Loader::lib('content:contentpage');
         $content = $contentpage->get_data($content, $maxcharperpage);
     }
     if ($rs['paginationtype'] != 0) {
         // 手动分页
         $CONTENT_POS = strpos($content, '[page]');
         if ($CONTENT_POS !== false) {
             $this->url = Loader::lib('content:url');
             $contents = array_filter(explode('[page]', $content));
             $pagenumber = count($contents);
             if (strpos($content, '[/page]') !== false && $CONTENT_POS < 7) {
                 $pagenumber--;
             }
             for ($i = 1; $i <= $pagenumber; $i++) {
                 $pageurls[$i] = $this->url->show($id, $i, $catid, $rs['inputtime']);
             }
             $END_POS = strpos($content, '[/page]');
             if ($END_POS !== false) {
                 if ($CONTENT_POS > 7) {
                     $content = '[page]' . $title . '[/page]' . $content;
                 }
                 if (preg_match_all("|\\[page\\](.*)\\[/page\\]|U", $content, $m, PREG_PATTERN_ORDER)) {
                     foreach ($m[1] as $k => $v) {
                         $p = $k + 1;
                         $titles[$p]['title'] = strip_tags($v);
                         $titles[$p]['url'] = $pageurls[$p][0];
                     }
                 }
             }
             // 当不存在 [/page]时,则使用下面分页
             $pages = content_pages($pagenumber, $page, $pageurls);
             // 判断[page]出现的位置是否在第一位
             if ($CONTENT_POS < 7) {
                 $content = $contents[$page];
             } else {
                 if ($page == 1 && !empty($titles)) {
                     $content = $title . '[/page]' . $contents[$page - 1];
                 } else {
                     $content = $contents[$page - 1];
                 }
             }
             if ($titles) {
                 list($title, $content) = explode('[/page]', $content);
                 $content = trim($content);
                 if (strpos($content, '</p>') === 0) {
                     $content = '<p>' . $content;
                 }
                 if (stripos($content, '<p>') === 0) {
                     $content = $content . '</p>';
                 }
             }
         }
     }
     $this->db->table_name = $tablename;
     // 上一页
     $previous_page = $this->db->where(array('status' => 99, 'catid' => $catid, 'id' => array('lt', $id)))->order('id DESC')->find();
     // 下一页
     $next_page = $this->db->where(array('status' => 99, 'catid' => $catid, 'id' => array('gt', $id)))->find();
     if (empty($previous_page)) {
         $previous_page = array('title' => L('first_page'), 'thumb' => IMG_PATH . 'nopic_small.gif', 'url' => 'javascript:alert(\'' . L('first_page') . '\');');
     }
     if (empty($next_page)) {
         $next_page = array('title' => L('last_page'), 'thumb' => IMG_PATH . 'nopic_small.gif', 'url' => 'javascript:alert(\'' . L('last_page') . '\');');
     }
     include template('content', $template);
 }
开发者ID:hubs,项目名称:yuncms,代码行数:101,代码来源:IndexController.php

示例2: show


//.........这里部分代码省略.........
             $http_referer = urlencode(get_url());
             $allow_visitor = sys_auth($catid . '_' . $id . '|' . $readpoint . '|' . $paytype) . '&http_referer=' . $http_referer;
         } else {
             $allow_visitor = 1;
         }
     }
     //最顶级栏目ID
     $arrparentid = explode(',', $CAT['arrparentid']);
     $top_parentid = $arrparentid[1] ? $arrparentid[1] : $catid;
     $brother_cats = subcat($top_parentid);
     //顶级栏目子栏目集合,03月10日
     $template = $template ? $template : $CAT['setting']['show_template'];
     if (!$template) {
         $template = 'show';
     }
     //SEO
     $seo_keywords = '';
     if (!empty($keywords)) {
         $seo_keywords = implode(',', $keywords);
     }
     $_cateinfo = M("category")->get_one("catid=" . $catid);
     $sys_title = M("safe_system")->get_one("id=1");
     $SEO = array('site_title' => $sys_title['attr_value'], 'keyword' => empty($seo_keywords) ? $sys_title['attr_value'] : $seo_keywords, "description" => $sys_title['attr_value'], 'title' => $title . " - " . $_cateinfo['catname'] . " - ");
     define('STYLE', $CAT['setting']['template_list']);
     if (isset($rs['paginationtype'])) {
         $paginationtype = $rs['paginationtype'];
         $maxcharperpage = $rs['maxcharperpage'];
     }
     $pages = $titles = '';
     if ($rs['paginationtype'] == 1) {
         //自动分页
         if ($maxcharperpage < 10) {
             $maxcharperpage = 500;
         }
         $contentpage = pc_base::load_app_class('contentpage');
         $content = $contentpage->get_data($content, $maxcharperpage);
     }
     if ($rs['paginationtype'] != 0) {
         //手动分页
         $CONTENT_POS = strpos($content, '[page]');
         if ($CONTENT_POS !== false) {
             $this->url = pc_base::load_app_class('url', 'content');
             $contents = array_filter(explode('[page]', $content));
             $pagenumber = count($contents);
             if (strpos($content, '[/page]') !== false && $CONTENT_POS < 7) {
                 $pagenumber--;
             }
             for ($i = 1; $i <= $pagenumber; $i++) {
                 $pageurls[$i] = $this->url->show($id, $i, $catid, $rs['inputtime']);
             }
             $END_POS = strpos($content, '[/page]');
             if ($END_POS !== false) {
                 if ($CONTENT_POS > 7) {
                     $content = '[page]' . $title . '[/page]' . $content;
                 }
                 if (preg_match_all("|\\[page\\](.*)\\[/page\\]|U", $content, $m, PREG_PATTERN_ORDER)) {
                     foreach ($m[1] as $k => $v) {
                         $p = $k + 1;
                         $titles[$p]['title'] = strip_tags($v);
                         $titles[$p]['url'] = $pageurls[$p][0];
                     }
                 }
             }
             //当不存在 [/page]时,则使用下面分页
             $pages = content_pages($pagenumber, $page, $pageurls);
             //判断[page]出现的位置是否在第一位
             if ($CONTENT_POS < 7) {
                 $content = $contents[$page];
             } else {
                 if ($page == 1 && !empty($titles)) {
                     $content = $title . '[/page]' . $contents[$page - 1];
                 } else {
                     $content = $contents[$page - 1];
                 }
             }
             if ($titles) {
                 list($title, $content) = explode('[/page]', $content);
                 $content = trim($content);
                 if (strpos($content, '</p>') === 0) {
                     $content = '<p>' . $content;
                 }
                 if (stripos($content, '<p>') === 0) {
                     $content = $content . '</p>';
                 }
             }
         }
     }
     $this->db->table_name = $tablename;
     //上一页
     $previous_page = $this->db->get_one("`catid` = '{$catid}' AND `id`<'{$id}' AND `status`=99", '*', 'id DESC');
     //下一页
     $next_page = $this->db->get_one("`catid`= '{$catid}' AND `id`>'{$id}' AND `status`=99");
     if (empty($previous_page)) {
         $previous_page = array('title' => L('first_page'), 'thumb' => IMG_PATH . 'nopic_small.gif', 'url' => 'javascript:alert(\'' . L('first_page') . '\');');
     }
     if (empty($next_page)) {
         $next_page = array('title' => L('last_page'), 'thumb' => IMG_PATH . 'nopic_small.gif', 'url' => 'javascript:alert(\'' . L('last_page') . '\');');
     }
     include template('content', $template);
 }
开发者ID:zhouzhouxs,项目名称:Progect,代码行数:101,代码来源:index.php

示例3: show

 public function show()
 {
     $WAP = $this->wap;
     $WAP_SETTING = string2array($WAP['setting']);
     $TYPE = $this->types;
     $GLOBALS['siteid'] = $siteid = max($this->siteid, 1);
     $typeid = $type_tmp = intval($_GET['typeid']);
     $catid = $_GET['catid'];
     $id = intval($_GET['id']);
     if (!$catid || !$id) {
         exit(L('parameter_error'));
     }
     $siteids = getcache('category_content', 'commons');
     $siteid = $siteids[$catid];
     $CATEGORYS = getcache('category_content_' . $siteid, 'commons');
     $page = intval($_GET['page']);
     $page = max($page, 1);
     if (!isset($CATEGORYS[$catid]) || $CATEGORYS[$catid]['type'] != 0) {
         exit(L('information_does_not_exist', '', 'content'));
     }
     $this->category = $CAT = $CATEGORYS[$catid];
     $this->category_setting = $CAT['setting'] = string2array($this->category['setting']);
     $siteid = $GLOBALS['siteid'] = $CAT['siteid'];
     $MODEL = getcache('model', 'commons');
     $modelid = $CAT['modelid'];
     $tablename = $this->db->table_name = $this->db->db_tablepre . $MODEL[$modelid]['tablename'];
     $r = $this->db->get_one(array('id' => $id));
     if (!$r || $r['status'] != 99) {
         showmessage(L('info_does_not_exists'), 'blank');
     }
     $this->db->table_name = $tablename . '_data';
     $r2 = $this->db->get_one(array('id' => $id));
     $rs = $r2 ? array_merge($r, $r2) : $r;
     //再次重新赋值,以数据库为准
     $catid = $CATEGORYS[$r['catid']]['catid'];
     $modelid = $CATEGORYS[$catid]['modelid'];
     require_once CACHE_MODEL_PATH . 'content_output.class.php';
     $content_output = new content_output($modelid, $catid, $CATEGORYS);
     $data = $content_output->get($rs);
     extract($data);
     $typeid = $type_tmp;
     if (strpos($content, '[/page]') !== false) {
         $content = preg_replace("|\\[page\\](.*)\\[/page\\]|U", '', $content);
     } elseif (strpos($content, '[page]') !== false) {
         $content = str_replace('[page]', '', $content);
     }
     //根据设置字节数对文章加入分页标记
     if ($maxcharperpage < 10) {
         $maxcharperpage = $WAP_SETTING['c_num'];
     }
     $contentpage = pc_base::load_app_class('contentpage', 'content');
     $content = $contentpage->get_data($content, $maxcharperpage);
     $isshow = 1;
     if ($pictureurls) {
         $pictureurl = pic_pages($pictureurls);
         $isshow = 0;
         //进行图片分页处理
         $PIC_POS = strpos($pictureurl, '[page]');
         if ($PIC_POS !== false) {
             $this->url = pc_base::load_app_class('wap_url', 'wap');
             $pictureurls = array_filter(explode('[page]', $pictureurl));
             $pagenumber = count($pictureurls);
             if (strpos($pictureurl, '[/page]') !== false && $CONTENT_POS < 7) {
                 $pagenumber--;
             }
             for ($i = 1; $i <= $pagenumber; $i++) {
                 $pageurls[$i] = $this->url->show($id, $i, $catid, $typeid);
             }
             $END_POS = strpos($pictureurl, '[/page]');
             if ($END_POS !== false) {
                 if (preg_match_all("|\\[page\\](.*)\\[/page\\]|U", $pictureurl, $m, PREG_PATTERN_ORDER)) {
                     foreach ($m[1] as $k => $v) {
                         $p = $k + 1;
                         $titles[$p]['title'] = strip_tags($v);
                         $titles[$p]['url'] = $pageurls[$p][0];
                     }
                 }
             }
             //当不存在 [/page]时,则使用下面分页
             $pages = content_pages($pagenumber, $page, $pageurls, 0);
             //判断[page]出现的位置是否在第一位
             if ($CONTENT_POS < 7) {
                 $pictureurl = $pictureurls[$page];
             } else {
                 if ($page == 1 && !empty($titles)) {
                     $pictureurl = $title . '[/page]' . $pictureurls[$page - 1];
                 } else {
                     $pictureurl = $pictureurls[$page - 1];
                 }
             }
         }
     }
     //进行自动分页处理
     $CONTENT_POS = strpos($content, '[page]');
     if ($CONTENT_POS !== false) {
         $this->url = pc_base::load_app_class('wap_url', 'wap');
         $contents = array_filter(explode('[page]', $content));
         $pagenumber = count($contents);
         if (strpos($content, '[/page]') !== false && $CONTENT_POS < 7) {
             $pagenumber--;
//.........这里部分代码省略.........
开发者ID:baowzh,项目名称:fulianweb,代码行数:101,代码来源:index.php

示例4: show


//.........这里部分代码省略.........
     $this->db->set_model($modelid);
     //上一页
     $previous_page = $this->db->get_one("`catid` = '{$catid}' AND `id`<'{$id}' AND `status`=99", '*', 'id DESC');
     //下一页
     $next_page = $this->db->get_one("`catid`= '{$catid}' AND `id`>'{$id}' AND `status`=99");
     if (empty($previous_page)) {
         $previous_page = array('title' => L('first_page', '', 'content'), 'thumb' => IMG_PATH . 'nopic_small.gif', 'url' => 'javascript:alert(\'' . L('first_page', '', 'content') . '\');');
     }
     if (empty($next_page)) {
         $next_page = array('title' => L('last_page', '', 'content'), 'thumb' => IMG_PATH . 'nopic_small.gif', 'url' => 'javascript:alert(\'' . L('last_page', '', 'content') . '\');');
     }
     $title = strip_tags($title);
     //SEO
     $seo_keywords = '';
     if (!empty($keywords)) {
         $seo_keywords = implode(',', $keywords);
     }
     $siteid = $this->siteid;
     $SEO = seo($siteid, $catid, $title, $description, $seo_keywords);
     $ishtml = 1;
     $template = $template ? $template : $CAT['setting']['show_template'];
     //分页处理
     $pages = $titles = '';
     if ($paginationtype == 1) {
         //自动分页
         if ($maxcharperpage < 10) {
             $maxcharperpage = 500;
         }
         $contentpage = pc_base::load_app_class('contentpage');
         $content = $contentpage->get_data($content, $maxcharperpage);
     }
     if ($paginationtype != 0) {
         //手动分页
         $CONTENT_POS = strpos($content, '[page]');
         if ($CONTENT_POS !== false) {
             $this->url = pc_base::load_app_class('url', 'content');
             $contents = array_filter(explode('[page]', $content));
             $pagenumber = count($contents);
             if (strpos($content, '[/page]') !== false && $CONTENT_POS < 7) {
                 $pagenumber--;
             }
             for ($i = 1; $i <= $pagenumber; $i++) {
                 $upgrade = $upgrade ? '/' . ltrim($file, WEB_PATH) : '';
                 $pageurls[$i] = $this->url->show($id, $i, $catid, $data['inputtime'], '', '', 'edit', $upgrade);
             }
             $END_POS = strpos($content, '[/page]');
             if ($END_POS !== false) {
                 if ($CONTENT_POS > 7) {
                     $content = '[page]' . $title . '[/page]' . $content;
                 }
                 if (preg_match_all("|\\[page\\](.*)\\[/page\\]|U", $content, $m, PREG_PATTERN_ORDER)) {
                     foreach ($m[1] as $k => $v) {
                         $p = $k + 1;
                         $titles[$p]['title'] = strip_tags($v);
                         $titles[$p]['url'] = $pageurls[$p][0];
                     }
                 }
             }
             //生成分页
             foreach ($pageurls as $page => $urls) {
                 $pages = content_pages($pagenumber, $page, $pageurls);
                 //判断[page]出现的位置是否在第一位
                 if ($CONTENT_POS < 7) {
                     $content = $contents[$page];
                 } else {
                     if ($page == 1 && !empty($titles)) {
                         $content = $title . '[/page]' . $contents[$page - 1];
                     } else {
                         $content = $contents[$page - 1];
                     }
                 }
                 if ($titles) {
                     list($title, $content) = explode('[/page]', $content);
                     $content = trim($content);
                     if (strpos($content, '</p>') === 0) {
                         $content = '<p>' . $content;
                     }
                     if (stripos($content, '<p>') === 0) {
                         $content = $content . '</p>';
                     }
                 }
                 $pagefile = $urls[1];
                 if ($this->siteid != 1) {
                     $pagefile = $this->html_root . '/' . $site_dir . $pagefile;
                 }
                 $this->queue->add_queue($action, $pagefile, $this->siteid);
                 $pagefile = PHPCMS_PATH . $pagefile;
                 ob_start();
                 include template('content', $template);
                 $this->createhtml($pagefile);
             }
             return true;
         }
     }
     //分页处理结束
     $file = PHPCMS_PATH . $file;
     ob_start();
     include template('content', $template);
     return $this->createhtml($file);
 }
开发者ID:cfhb,项目名称:MIS,代码行数:101,代码来源:html.class.php

示例5: public_preview

 public function public_preview()
 {
     $catid = intval($_GET['catid']);
     $id = intval($_GET['id']);
     if (!$catid || !$id) {
         showmessage(L('missing_part_parameters'), 'blank');
     }
     $page = intval($_GET['page']);
     $page = max($page, 1);
     $CATEGORYS = getcache('category_content_' . $this->get_siteid(), 'commons');
     if (!isset($CATEGORYS[$catid]) || $CATEGORYS[$catid]['type'] != 0) {
         showmessage(L('missing_part_parameters'), 'blank');
     }
     define('HTML', true);
     $CAT = $CATEGORYS[$catid];
     $siteid = $CAT['siteid'];
     $MODEL = getcache('model', 'commons');
     $modelid = $CAT['modelid'];
     $this->db->table_name = $this->db->db_tablepre . $MODEL[$modelid]['tablename'];
     $r = $this->db->get_one(array('id' => $id));
     if (!$r) {
         showmessage(L('information_does_not_exist'));
     }
     $this->db->table_name = $this->db->table_name . '_data';
     $r2 = $this->db->get_one(array('id' => $id));
     $rs = $r2 ? array_merge($r, $r2) : $r;
     //再次重新赋值,以数据库为准
     $catid = $CATEGORYS[$r['catid']]['catid'];
     $modelid = $CATEGORYS[$catid]['modelid'];
     require_once CACHE_MODEL_PATH . 'content_output.class.php';
     $content_output = new content_output($modelid, $catid, $CATEGORYS);
     $data = $content_output->get($rs);
     extract($data);
     $CAT['setting'] = string2array($CAT['setting']);
     $template = $template ? $template : $CAT['setting']['show_template'];
     $allow_visitor = 1;
     //SEO
     $SEO = seo($siteid, $catid, $title, $description);
     define('STYLE', $CAT['setting']['template_list']);
     if (isset($rs['paginationtype'])) {
         $paginationtype = $rs['paginationtype'];
         $maxcharperpage = $rs['maxcharperpage'];
     }
     $pages = $titles = '';
     if ($rs['paginationtype'] == 1) {
         //自动分页
         if ($maxcharperpage < 10) {
             $maxcharperpage = 500;
         }
         $contentpage = pc_base::load_app_class('contentpage');
         $content = $contentpage->get_data($content, $maxcharperpage);
     }
     if ($rs['paginationtype'] != 0) {
         //手动分页
         $CONTENT_POS = strpos($content, '[page]');
         if ($CONTENT_POS !== false) {
             $this->url = pc_base::load_app_class('url', 'content');
             $contents = array_filter(explode('[page]', $content));
             $pagenumber = count($contents);
             for ($i = 1; $i <= $pagenumber; $i++) {
                 $pageurls[$i] = $this->url->show($id, $i, $catid, $rs['inputtime']);
             }
             $END_POS = strpos($content, '[/page]');
             if ($END_POS !== false) {
                 if (preg_match_all("|\\[page\\](.*)\\[/page\\]|U", $content, $m, PREG_PATTERN_ORDER)) {
                     foreach ($m[1] as $k => $v) {
                         $p = $k + 1;
                         $titles[$p]['title'] = strip_tags($v);
                         $titles[$p]['url'] = $pageurls[$p][0];
                     }
                 }
             } else {
                 //当不存在 [/page]时,则使用下面分页
                 $pages = content_pages($pagenumber, $page, $pageurls);
             }
             //判断[page]出现的位置是否在第一位
             if ($CONTENT_POS < 7) {
                 $content = $contents[$page];
             } else {
                 $content = $contents[$page - 1];
             }
             if ($titles) {
                 list($title, $content) = explode('[/page]', $content);
                 $content = trim($content);
                 if (strpos($content, '</p>') === 0) {
                     $content = '<p>' . $content;
                 }
                 if (stripos($content, '<p>') === 0) {
                     $content = $content . '</p>';
                 }
             }
         }
     }
     include template('content', $template);
     $pc_hash = $_SESSION['pc_hash'];
     $steps = intval($_GET['steps']);
     echo "\n\t\t<link href=\"" . CSS_PATH . "dialog_simp.css\" rel=\"stylesheet\" type=\"text/css\" />\n\t\t<script language=\"javascript\" type=\"text/javascript\" src=\"" . JS_PATH . "dialog.js\"></script>\n\t\t<script type=\"text/javascript\">art.dialog({lock:false,title:'" . L('operations_manage') . "',mouse:true, id:'content_m', content:'<span id=cloading ><a href=\\'javascript:ajax_manage(1)\\'>" . L('passed_checked') . "</a> | <a href=\\'javascript:ajax_manage(2)\\'>" . L('reject') . "</a> | <a href=\\'javascript:ajax_manage(3)\\'>" . L('delete') . "</a></span>',left:'100%',top:'100%',width:200,height:50,drag:true, fixed:true});\n\t\tfunction ajax_manage(type) {\n\t\t\tif(type==1) {\n\t\t\t\t\$.get('?m=content&c=content&a=pass&ajax_preview=1&catid=" . $catid . "&steps=" . $steps . "&id=" . $id . "&pc_hash=" . $pc_hash . "');\n\t\t\t} else if(type==2) {\n\t\t\t\t\$.get('?m=content&c=content&a=pass&ajax_preview=1&reject=1&catid=" . $catid . "&steps=" . $steps . "&id=" . $id . "&pc_hash=" . $pc_hash . "');\n\t\t\t} else if(type==3) {\n\t\t\t\t\$.get('?m=content&c=content&a=delete&ajax_preview=1&dosubmit=1&catid=" . $catid . "&steps=" . $steps . "&id=" . $id . "&pc_hash=" . $pc_hash . "');\n\t\t\t}\n\t\t\t\$('#cloading').html('<font color=red>" . L('operation_success') . "<span id=\"secondid\">2</span>" . L('after_a_few_seconds_left') . "</font>');\n\t\t\tsetInterval('set_time()', 1000);\n\t\t\tsetInterval('window.close()', 2000);\n\t\t}\n\t\tfunction set_time() {\n\t\t\t\$('#secondid').html(1);\n\t\t}\n\t\t</script>";
 }
开发者ID:pondyond,项目名称:phpcmsv9,代码行数:98,代码来源:content.php

示例6: show

 /**
  * 专题展示
  */
 public function show()
 {
     $id = intval($_GET['id']);
     if (!$id) {
         showmessage(L('content_not_exist'), 'blank');
     }
     $page = $_GET['page'];
     $c_db = pc_base::load_model('special_content_model');
     $c_data_db = pc_base::load_model('special_c_data_model');
     $rs = $c_db->get_one(array('id' => $id));
     if (!$rs) {
         showmessage(L('content_checking'), 'blank');
     }
     extract($rs);
     if ($isdata) {
         $arr_content = $c_data_db->get_one(array('id' => $id));
         if (is_array($arr_content)) {
             extract($arr_content);
         }
     }
     $siteid = get_siteid();
     if ($paginationtype) {
         //文章使用分页时
         if ($paginationtype == 1) {
             if (strpos($content, '[/page]') !== false) {
                 $content = preg_replace("|\\[page\\](.*)\\[/page\\]|U", '', $content);
             }
             if (strpos($content, '[page]') !== false) {
                 $content = str_replace('[page]', '', $content);
             }
             $contentpage = pc_base::load_app_class('contentpage', 'content');
             //调用自动分页类
             $content = $contentpage->get_data($content, $maxcharperpage);
             //自动分页,自动添加上[page]
         }
     } else {
         if (strpos($content, '[/page]') !== false) {
             $content = preg_replace("|\\[page\\](.*)\\[/page\\]|U", '', $content);
         }
         if (strpos($content, '[page]') !== false) {
             $content = str_replace('[page]', '', $content);
         }
     }
     $template = $show_template ? $show_template : 'show';
     //调用模板
     $CONTENT_POS = strpos($content, '[page]');
     if ($CONTENT_POS !== false) {
         $contents = array_filter(explode('[page]', $content));
         $pagenumber = count($contents);
         $END_POS = strpos($content, '[/page]');
         if ($END_POS !== false && $CONTENT_POS < 7) {
             $pagenumber--;
         }
         for ($i = 1; $i <= $pagenumber; $i++) {
             $pageurls[$i] = content_url($id, $i, $inputtime, 'php');
         }
         if ($END_POS !== false) {
             if ($CONTENT_POS > 7) {
                 $content = '[page]' . $title . '[/page]' . $content;
             }
             if (preg_match_all("|\\[page\\](.*)\\[/page\\]|U", $content, $m, PREG_PATTERN_ORDER)) {
                 foreach ($m[1] as $k => $v) {
                     $p = $k + 1;
                     $titles[$p]['title'] = strip_tags($v);
                     $titles[$p]['url'] = $pageurls[$p][1];
                 }
             }
         }
         //判断[page]出现的位置是否在第一位
         if ($CONTENT_POS < 7) {
             $content = $contents[$page];
         } else {
             if ($page == 1 && !empty($titles)) {
                 $content = $title . '[/page]' . $contents[$page - 1];
             } else {
                 $content = $contents[$page - 1];
             }
         }
         if ($titles) {
             list($title, $content) = explode('[/page]', $content);
             $content = trim($content);
             if (strpos($content, '</p>') === 0) {
                 $content = '<p>' . $content;
             }
             if (stripos($content, '<p>') === 0) {
                 $content = $content . '</p>';
             }
         }
         pc_base::load_app_func('util', 'content');
         $title_pages = content_pages($pagenumber, $page, $pageurls);
     }
     $_special = $this->db->get_one(array('id' => $specialid), '`title`, `url`, `show_template`, `isvideo`');
     if ($_special['isvideo']) {
         $video_store = pc_base::load_model('video_store_model');
         $v_r = $video_store->get_one(array('videoid' => $videoid), 'vid');
         $video['vid'] = $v_r['vid'];
     }
//.........这里部分代码省略.........
开发者ID:shenhua4286,项目名称:gxw,代码行数:101,代码来源:index.php

示例7: _create_content


//.........这里部分代码省略.........
             $contentpage = pc_base::load_app_class('contentpage', 'content');
             //调用自动分页类
             $arr_content['content'] = $contentpage->get_data($arr_content['content'], $arr_content['maxcharperpage']);
             //自动分页,自动添加上[page]
         }
     } else {
         if (strpos($arr_content['content'], '[/page]') !== false) {
             $arr_content['content'] = preg_replace("|\\[page\\](.*)\\[/page\\]|U", '', $arr_content['content']);
         }
         if (strpos($arr_content['content'], '[page]') !== false) {
             $arr_content['content'] = str_replace('[page]', '', $arr_content['content']);
         }
     }
     $template = $arr_content['show_template'] ? $arr_content['show_template'] : 'show';
     //调用模板
     //分站时,计算分站路径
     if ($s_info['siteid'] > 1) {
         $site_info = $this->site->get_by_id($s_info['siteid']);
     }
     $siteid = $s_info['siteid'];
     $CONTENT_POS = strpos($arr_content['content'], '[page]');
     if ($CONTENT_POS !== false) {
         $contents = array_filter(explode('[page]', $arr_content['content']));
         $pagenumber = count($contents);
         $END_POS = strpos($arr_content['content'], '[/page]');
         if ($END_POS !== false && $CONTENT_POS < 7) {
             $pagenumber--;
         }
         for ($i = 1; $i <= $pagenumber; $i++) {
             $pageurls[$i] = content_url($contentid, $i, $inputtime, 'html', $site_info);
         }
         if ($END_POS !== false) {
             if ($CONTENT_POS > 7) {
                 $arr_content['content'] = '[page]' . $title . '[/page]' . $arr_content['content'];
             }
             if (preg_match_all("|\\[page\\](.*)\\[/page\\]|U", $arr_content['content'], $m, PREG_PATTERN_ORDER)) {
                 foreach ($m[1] as $k => $v) {
                     $p = $k + 1;
                     $titles[$p]['title'] = strip_tags($v);
                     $titles[$p]['url'] = $pageurls[$p][1];
                 }
             }
         }
         $currentpage = $filesize = 0;
         for ($i = 1; $i <= $pagenumber; $i++) {
             $currentpage++;
             //判断[page]出现的位置是否在第一位
             if ($CONTENT_POS < 7) {
                 $content = $contents[$currentpage];
             } else {
                 if ($currentpage == 1 && !empty($titles)) {
                     $content = $title . '[/page]' . $contents[$currentpage - 1];
                 } else {
                     $content = $contents[$currentpage - 1];
                 }
             }
             if ($titles) {
                 list($title, $content) = explode('[/page]', $content);
                 $content = trim($content);
                 if (strpos($content, '</p>') === 0) {
                     $content = '<p>' . $content;
                 }
                 if (stripos($content, '<p>') === 0) {
                     $content = $content . '</p>';
                 }
             }
             $file_url = content_url($contentid, $currentpage, $inputtime, 'html', $site_info);
             if ($currentpage == 1) {
                 $urls = $file_url;
             }
             pc_base::load_app_func('util', 'content');
             $title_pages = content_pages($pagenumber, $currentpage, $pageurls);
             $SEO = seo($s_info['siteid'], '', $title);
             $file = $file_url[1];
             //如果是分站的文件,将文件写入到信息队列中
             $this->queue->add_queue('add', $file, $siteid);
             $file = PHPCMS_PATH . $file;
             //生成文件的路径
             ob_start();
             include template('special', $template);
             $this->create_html($file);
         }
     } else {
         $page = 1;
         $title = strip_tags($title);
         $SEO = seo($s_info['siteid'], '', $title);
         $content = $arr_content['content'];
         $urls = content_url($contentid, $page, $inputtime, 'html', $site_info);
         $file = $urls[1];
         //如果是分站的文件,将文件写入到信息队列中
         $this->queue->add_queue('add', $file, $siteid);
         $file = PHPCMS_PATH . $file;
         ob_start();
         include template('special', $template);
         $this->create_html($file);
     }
     //$this->_index($specialid, 20, 5);  //更新专题首页
     //$this->_list($typeid, 20, 5); 		//更新所在的分类页
     return $urls;
 }
开发者ID:boylzj,项目名称:omguitar,代码行数:101,代码来源:html.class.php

示例8: create_list

 public function create_list($catid, $p = 1, $count = 0)
 {
     $_GET['p'] = $p;
     if (APP_LANG) {
         $lang = C('URL_LANG') != LANG_NAME ? $lang = LANG_NAME . '/' : '';
         L(include LANG_PATH . LANG_NAME . '/common.php');
         $T = F('config_' . LANG_NAME, '', './Template/' . $this->sysConfig['DEFAULT_THEME'] . '/');
     } else {
         L(include LANG_PATH . $this->sysConfig['DEFAULT_LANG'] . '/common.php');
         $T = F('config_' . $this->sysConfig['DEFAULT_LANG'], '', './Template/' . $this->sysConfig['DEFAULT_THEME'] . '/');
     }
     $this->assign('T', $T);
     $search_module[0] = L('ALL');
     foreach ((array) $this->module as $r) {
         if ($r['issystem']) {
             $search_module[$r['id']] = L($r['name']);
         }
     }
     $this->assign('search_module', $search_module);
     $this->assign('form', new Form());
     $this->assign($this->Config);
     $this->assign('Categorys', $this->categorys);
     $this->assign('Module', $this->module);
     $this->assign('Type', $this->Type);
     $catid = intval($catid);
     if (empty($catid)) {
         $this->success(L('do_empty'));
     }
     $cat = $this->categorys[$catid];
     $this->assign('catid', $catid);
     if ($cat['type']) {
         return;
     }
     if (empty($cat['ishtml'])) {
         return;
     }
     unset($cat['id']);
     $this->assign($cat);
     $cat['id'] = $catid;
     $bcid = explode(",", $cat['arrparentid']);
     $bcid = $bcid[1];
     if ($bcid == '') {
         $bcid = intval($catid);
     }
     $this->assign('bcid', $bcid);
     $urlrule = geturl($cat, '', $this->Urlrule);
     $url = $p > 1 ? $urlrule[1] : $urlrule[0];
     $url = str_replace('{$p}', $p, $url);
     if (strstr($url, C('HTML_FILE_SUFFIX'))) {
         $filename = basename($url, C('HTML_FILE_SUFFIX'));
         $dir = dirname($url) . '/';
     } else {
         $filename = 'index';
         $dir = $url;
     }
     $dir = substr($dir, strlen(YP_PATH . '/'));
     if (empty($module)) {
         $module = $cat['module'];
     }
     $this->assign('module_name', $module);
     $this->assign('fields', F($cat['moduleid'] . '_Field'));
     $this->assign('form', new Form());
     if ($cat['moduleid'] == 1) {
         $cat['listtype'] = 2;
         $module = $cat['module'];
         $dao = M($module);
         $data = $dao->find($catid);
         $seo_title = $cat['title'] ? $cat['title'] : $data['title'];
         $this->assign('seo_title', $seo_title);
         $this->assign('seo_keywords', $data['keywords']);
         $this->assign('seo_description', $data['description']);
         $template = $cat['template_list'] ? $cat['template_list'] : 'index';
         //手动分页
         $CONTENT_POS = strpos($data['content'], '[page]');
         if ($CONTENT_POS !== false) {
             $contents = array_filter(explode('[page]', $data['content']));
             $pagenumber = count($contents);
             for ($i = 1; $i <= $pagenumber; $i++) {
                 $pageurls[$i] = str_replace('{$p}', $i, $urlrule);
             }
             //生成分页
             foreach ($pageurls as $p => $urls) {
                 $pages = content_pages($pagenumber, $p, $pageurls);
                 $this->assign('pages', $pages);
                 $data['content'] = $contents[$p - 1];
                 $this->assign($data);
                 if ($p > 1) {
                     $filename = basename($pageurls[$p]['1'], C('HTML_FILE_SUFFIX'));
                 }
                 $r = $this->buildHtml($filename, $dir, './Template/' . $this->sysConfig['DEFAULT_THEME'] . '/Page_' . $template . C('TMPL_TEMPLATE_SUFFIX'));
             }
         } else {
             $this->assign($data);
             $r = $this->buildHtml($filename, $dir, './Template/' . $this->sysConfig['DEFAULT_THEME'] . '/Page_' . $template . C('TMPL_TEMPLATE_SUFFIX'));
         }
     } else {
         $seo_title = $cat['title'] ? $cat['title'] : $cat['catname'];
         $this->assign('seo_title', $seo_title);
         $this->assign('seo_keywords', $cat['keywords']);
         $this->assign('seo_description', $cat['description']);
//.........这里部分代码省略.........
开发者ID:bossyuetao,项目名称:yuephp,代码行数:101,代码来源:AdminbaseAction.class.php

示例9: show

 public function show($id = '', $module = '')
 {
     $this->Urlrule = F('Urlrule');
     $p = max(intval($_REQUEST[C('VAR_PAGE')]), 1);
     $id = $id ? $id : intval($_REQUEST['id']);
     $module = $module ? $module : MODULE_NAME;
     $this->assign('module_name', $module);
     $this->dao = M($module);
     $data = $this->dao->find($id);
     $catid = $data['catid'];
     $cat = $this->categorys[$data['catid']];
     if (empty($cat['ishtml'])) {
         $this->dao->where("id=" . $id)->setInc('hits');
     }
     //添加点击次数
     $bcid = explode(",", $cat['arrparentid']);
     $bcid = $bcid[1];
     if ($bcid == '') {
         $bcid = intval($catid);
     }
     if ($data['readgroup']) {
         if ($this->_groupid != 1 && !in_array($this->_groupid, explode(',', $data['readgroup']))) {
             $noread = 1;
         }
     } elseif ($cat['readgroup']) {
         if ($this->_groupid != 1 && !in_array($this->_groupid, explode(',', $cat['readgroup']))) {
             $noread = 1;
         }
     }
     if ($noread == 1) {
         $this->assign('jumpUrl', URL('User-Login/index'));
         $this->error(L('NO_READ'));
     }
     $chargepoint = $data['readpoint'] ? $data['readpoint'] : $cat['chargepoint'];
     if ($chargepoint && $data['userid'] != $this->_userid) {
         $user = M('User');
         $userdata = $user->find($this->_userid);
         if ($cat['paytype'] == 1 && $userdata['point'] >= $chargepoint) {
             $chargepointok = $user->where("id=" . $this->_userid)->setDec('point', $chargepoint);
         } elseif ($cat['paytype'] == 2 && $userdata['amount'] >= $chargepoint) {
             $chargepointok = $user->where("id=" . $this->_userid)->setDec('amount', $chargepoint);
         } else {
             $this->error(L('NO_READ'));
         }
     }
     $seo_title = $data['title'] . '|' . $cat['catname'];
     $this->assign('seo_title', $seo_title);
     $this->assign('seo_keywords', $data['keywords']);
     $this->assign('seo_description', $data['description']);
     $this->assign('fields', F($cat['moduleid'] . '_Field'));
     $fields = F($this->mod[$module] . '_Field');
     foreach ($data as $key => $c_d) {
         $setup = '';
         $fields[$key]['setup'] = $setup = string2array($fields[$key]['setup']);
         if ($setup['fieldtype'] == 'varchar' && $fields[$key]['type'] != 'text') {
             $data[$key . '_old_val'] = $data[$key];
             $data[$key] = fieldoption($fields[$key], $data[$key]);
         } elseif ($fields[$key]['type'] == 'images' || $fields[$key]['type'] == 'files') {
             if (!empty($data[$key])) {
                 $p_data = explode(':::', $data[$key]);
                 $data[$key] = array();
                 foreach ($p_data as $k => $res) {
                     $p_data_arr = explode('|', $res);
                     $data[$key][$k]['filepath'] = $p_data_arr[0];
                     $data[$key][$k]['filename'] = $p_data_arr[1];
                 }
                 unset($p_data);
                 unset($p_data_arr);
             }
         }
         unset($setup);
     }
     $this->assign('fields', $fields);
     //手动分页
     $CONTENT_POS = strpos($data['content'], '[page]');
     if ($CONTENT_POS !== false) {
         $urlrule = geturl($cat, $data, $this->Urlrule);
         $urlrule = str_replace('%7B%24page%7D', '{$page}', $urlrule);
         $contents = array_filter(explode('[page]', $data['content']));
         $pagenumber = count($contents);
         for ($i = 1; $i <= $pagenumber; $i++) {
             $pageurls[$i] = str_replace('{$page}', $i, $urlrule);
         }
         $pages = content_pages($pagenumber, $p, $pageurls);
         //判断[page]出现的位置是否在文章开始
         if ($CONTENT_POS < 7) {
             $data['content'] = $contents[$p];
         } else {
             $data['content'] = $contents[$p - 1];
         }
         $this->assign('pages', $pages);
     }
     if (!empty($data['template'])) {
         $template = $data['template'];
     } elseif (!empty($cat['template_show'])) {
         $template = $cat['template_show'];
     } else {
         $template = 'show';
     }
     $this->assign('catid', $catid);
//.........这里部分代码省略.........
开发者ID:JavaAFei,项目名称:yun001,代码行数:101,代码来源:BaseAction.class.php

示例10: create_list

 public function create_list($catid, $p = 1, $count = 0)
 {
     C('DEFAULT_THEME_NAME', $this->sysConfig['DEFAULT_THEME']);
     C('HTML_FILE_SUFFIX', $this->sysConfig['HTML_FILE_SUFFIX']);
     C('TMPL_FILE_NAME', str_replace('Admin/Default', 'Home/' . $this->sysConfig['DEFAULT_THEME'], C('TMPL_FILE_NAME')));
     if (APP_LANG) {
         C('TMPL_CACHFILE_SUFFIX', '_' . LANG_NAME . '.php');
         $lang = C('URL_LANG') != LANG_NAME ? $lang = LANG_NAME . '/' : '';
         L(include LANG_PATH . LANG_NAME . '/common.php');
         $T = F('config_' . LANG_NAME, '', './Yourphp/Tpl/Home/' . $this->sysConfig['DEFAULT_THEME'] . '/');
     } else {
         L(include LANG_PATH . $this->sysConfig['DEFAULT_LANG'] . '/common.php');
         $T = F('config_' . $this->sysConfig['DEFAULT_LANG'], '', './Yourphp/Tpl/Home/' . $this->sysConfig['DEFAULT_THEME'] . '/');
     }
     $this->assign('T', $T);
     foreach ((array) $this->module as $r) {
         if ($r['issearch']) {
             $search_module[$r['name']] = L($r['name']);
         }
     }
     $this->assign('search_module', $search_module);
     $this->assign('form', new Form());
     $this->assign($this->Config);
     $this->assign('Categorys', $this->categorys);
     $this->assign('Module', $this->module);
     $this->assign('Type', $this->Type);
     $catid = intval($catid);
     if (empty($catid)) {
         $this->success(L('do_empty'));
     }
     $cat = $this->categorys[$catid];
     $this->assign('catid', $catid);
     if ($cat['type']) {
         return;
     }
     if (empty($cat['ishtml'])) {
         return;
     }
     unset($cat['id']);
     $this->assign($cat);
     $cat['id'] = $catid;
     $bcid = explode(",", $cat['arrparentid']);
     $bcid = $bcid[1];
     if ($bcid == '') {
         $bcid = intval($catid);
     }
     $this->assign('bcid', $bcid);
     $urlrule = geturl($cat, '', $this->Urlrule);
     $url = $p > 1 ? $urlrule[1] : $urlrule[0];
     $url = str_replace('{$page}', $p, $url);
     if (strstr($url, C('HTML_FILE_SUFFIX'))) {
         $filename = basename($url, C('HTML_FILE_SUFFIX'));
         $dir = dirname($url) . '/';
     } else {
         $filename = 'index';
         $dir = $url;
     }
     $dir = substr($dir, strlen(__ROOT__ . '/'));
     if (empty($module)) {
         $module = $cat['module'];
     }
     $this->assign('module_name', $module);
     $this->assign('fields', F($cat['moduleid'] . '_Field'));
     $this->assign('form', new Form());
     if ($cat['moduleid'] == 1) {
         $cat['listtype'] = 2;
         $module = $cat['module'];
         $dao = M($module);
         $data = $dao->find($catid);
         $seo_title = $cat['title'] ? $cat['title'] : $data['title'];
         $this->assign('seo_title', $seo_title);
         $this->assign('seo_keywords', $data['keywords']);
         $this->assign('seo_description', $data['description']);
         $template = $cat['template_list'] ? $cat['template_list'] : 'index';
         //手动分页
         $CONTENT_POS = strpos($data['content'], '[page]');
         if ($CONTENT_POS !== false) {
             $contents = array_filter(explode('[page]', $data['content']));
             $pagenumber = count($contents);
             for ($i = 1; $i <= $pagenumber; $i++) {
                 $pageurls[$i] = str_replace('{$page}', $i, $urlrule);
             }
             //生成分页
             foreach ($pageurls as $p => $urls) {
                 $pages = content_pages($pagenumber, $p, $pageurls);
                 $this->assign('pages', $pages);
                 $data['content'] = $contents[$p - 1];
                 $this->assign($data);
                 if ($p > 1) {
                     $filename = basename($pageurls[$p]['1'], C('HTML_FILE_SUFFIX'));
                 }
                 //$this->buildHtml($filename,$dir,'Home/'.$template);
                 $r = $this->buildHtml($filename, $dir, './Yourphp/Tpl/Home/' . $this->sysConfig['DEFAULT_THEME'] . '/Page_' . $template . C('TMPL_TEMPLATE_SUFFIX'));
             }
         } else {
             $this->assign($data);
             //$r=$this->buildHtml($filename,$dir,'Home/'.$template);
             $r = $this->buildHtml($filename, $dir, './Yourphp/Tpl/Home/' . $this->sysConfig['DEFAULT_THEME'] . '/Page_' . $template . C('TMPL_TEMPLATE_SUFFIX'));
         }
     } else {
//.........这里部分代码省略.........
开发者ID:Brave-Cheng,项目名称:huashengxiongdi,代码行数:101,代码来源:AdminbaseAction.class.php


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