用户名:  密码:    
中药方大全小图标
关键字:  
您当前的位置:首页 > 其他 > 网站日记

[帝国cms插件]给内容页生成封面

提示: 阅读权限:公开  来源:网络  作者: 未知

本插件 适用于 帝国cms 7.2 ,7.5
本插件实现的功能是:内容页如果有分页,为分页生成封面页。
本插件为收费插件,购买联系 110102296

代码备忘:

  1. jiuhecai   封面
  2.  
  3. 1. 新建一个内容模板,用于显示小说封面,记下这个模板的id
  4.  
  5. 2. 在模板里,用标签 [!--title.fm--]  来显示章节
  6.  
  7. 3. 本插件位置  /e/extend/jhcFM/
  8.  
  9. 4.  修改 /e/class/funciton.php 
  10.  
  11.     4.1查找   if($j==1){
  12.  
  13.    在其中  $murl=$mdolink.$add[filename].$filetype;之后 插入
  14.    
  15.      include_once ECMS_PATH."/e/extend/jhcFM/nrfm.php";
  16.      $string=GetHtmlFM($classid,$id,$add,$ecms,$doall);
  17.      
  18.      4.2 查找
  19.     
  20.      if($pf&&strstr($add[$pf],$expage))
  21.      在其中插入
  22.      
  23.       //jiuehecai  add for  fm
  24.         $add[$pf]=$expage.$add[$pf];
  25.     // add end

 函数备忘:

  1. //生成内容封面文件
  2.  
  3. function GetHtmlFM($classid,$id,$add,$ecms=0,$doall=0){
  4.     global $public_r,$class_r,$class_zr,$fun_r,$empire,$dbtbpre,$emod_r,$class_tr,$level_r,$etable_r,$mob_r;
  5.     $_POST[newstempid]=12;// 此处根据内容的封面模板id实际数值修改。
  6. //  include_once ECMS_PATH."/e/extend/jhcFM/nrfm.php"; 
  7.     $mid=$class_r[$classid]['modid'];
  8.     $tbname=$class_r[$classid][tbname];
  9.     
  10.     if(InfoIsInTable($tbname))//内部表
  11.     {
  12.         return '';
  13.     }
  14.  
  15.     
  16.     $add['id']=$id;
  17.     $add['classid']=$classid;
  18.     if($add['isurl'])
  19.     {
  20.         return '';
  21.     }
  22.     if(empty($doall))
  23.     {
  24.         if(!$add['stb']||$class_r[$add[classid]][showdt]==2||strstr($public_r['nreinfo'],','.$add['classid'].','))//不生成
  25.         {
  26.             return '';
  27.         }
  28.     }
  29.     //副表
  30.  
  31.     //路径
  32.     $iclasspath=ReturnSaveInfoPath($add[classid],$add[id]);
  33.     $doclasspath=eReturnTrueEcmsPath().$iclasspath;//moreport
  34.     $createinfopath=$doclasspath;
  35.     //建立日期目录
  36.     $newspath='';
  37.     if($add[newspath])
  38.     {
  39.         $createpath=$doclasspath.$add[newspath];
  40.         if(!file_exists($createpath))
  41.         {
  42.             $r[newspath]=FormatPath($add[classid],$add[newspath],1);
  43.         }
  44.         $createinfopath.=$add[newspath].'/';
  45.         $newspath=$add[newspath].'/';
  46.     }
  47.     
  48.     //新建存放目录
  49.     if($class_r[$add[classid]][filename]==3)
  50.     {
  51.         $createinfopath.=ReturnInfoSPath($add['filename']);
  52.         DoMkdir($createinfopath);
  53.         $fn3=1;
  54.     }
  55.     
  56.     //存文本
  57.     if($emod_r[$mid]['savetxtf'])
  58.     {
  59.         $stf=$emod_r[$mid]['savetxtf'];
  60.         if($add[$stf])
  61.         {
  62.             //$add[$stf]=GetTxtFieldText($add[$stf]);
  63.         }
  64.     }
  65.  
  66.     $GLOBALS['navclassid']=$add[classid];
  67.     $GLOBALS['navinfor']=$add;
  68.     
  69.     //取得内容模板
  70.     //$add[newstempid]=$add[newstempid]?$add[newstempid]:$class_r[$add[classid]][newstempid];
  71.     // 修改配置
  72.     $add[newstempid]=$_POST[newstempid];
  73.     $newstemp_r=$empire->fetch1("select temptext,showdate from ".GetTemptb("enewsnewstemp")." where tempid='$add[newstempid]' limit 1");
  74.     $newstemp_r['tempid']=$add['newstempid'];
  75.     if($public_r['opennotcj'])//启用反采集
  76.     {
  77.         $newstemp_r['temptext']=ReturnNotcj($newstemp_r['temptext']);
  78.     }
  79.     $newstemptext=$newstemp_r[temptext];
  80.     $formatdate=$newstemp_r[showdate];
  81.     //文件类型/权限
  82.     if($add[groupid]||$class_r[$add[classid]]['cgtoinfo'])
  83.     {
  84.         if(empty($add[newspath]))
  85.         {
  86.             $include='';
  87.         }
  88.         else
  89.         {
  90.             $pr=explode('/',$add[newspath]);
  91.             for($i=0;$i<count($pr);$i++)
  92.             {
  93.                 $include.='../';
  94.             }
  95.         }
  96.         if($fn3==1)
  97.         {
  98.             $include.='../';
  99.         }
  100.         $pr=explode('/',$iclasspath);
  101.         $pcount=count($pr);
  102.         for($i=0;$i<$pcount-1;$i++)
  103.         {
  104.             $include.='../';
  105.         }
  106.         $include1=$include;
  107.         $include.='e/class/CheckLevel.php';
  108.         $filetype='.php';
  109.         $addlevel="<?php
  110.         define('empirecms','wm_chief');
  111.         $check_tbname='".$class_r[$add[classid]][tbname]."';
  112.         $check_infoid=".$add[id].";
  113.         $check_classid=".$add[classid].";
  114.         $check_path="".$include1."";
  115.         require("".$include."");
  116.         ?>";
  117.     }
  118.     else
  119.     {
  120.         $filetype=$class_r[$add[classid]][filetype];
  121.         $addlevel='';
  122.     }
  123.     //取得本目录链接
  124.     if($class_r[$add[classid]][classurl]&&$class_r[$add[classid]][ipath]=='')//域名
  125.     {
  126.         $dolink=$class_r[$add[classid]][classurl].'/'.$newspath;
  127.     }
  128.     else
  129.     {
  130.         $dolink=$public_r[newsurl].$iclasspath.$newspath;
  131.     }
  132.     $mdolink=$mob_r['msiteurl'].$iclasspath.$newspath;
  133.     //返回替换验证字符
  134.     $docheckrep=ReturnCheckDoRepStr();
  135.     if($add[newstext])
  136.     {
  137.         if(empty($public_r['dorepword'])&&$docheckrep[3])
  138.         {
  139.             $add[newstext]=ReplaceWord($add[newstext]);//过滤字符
  140.         }
  141.         if(empty($public_r['dorepkey'])&&$docheckrep[4]&&!empty($add[dokey]))//替换关键字
  142.         {
  143.             $add[newstext]=ReplaceKey($add['newstext'],$add['classid']);
  144.         }
  145.         if($public_r['opencopytext'])
  146.         {
  147.             $add[newstext]=AddNotCopyRndStr($add[newstext]);//随机复制字符
  148.         }
  149.     }
  150.     //返回编译
  151.     $newstemptext=GetInfoNewsBq($classid,$newstemp_r,$add,$docheckrep);
  152.     //分页字段
  153.     $expage='[!--empirenews.page--]';//分页符
  154.     $pf=$emod_r[$mid]['pagef'];
  155.     
  156.     //变量替换
  157.     $newstempstr=$newstemptext;//模板
  158.     // add by  jiuehcai 
  159.     //jiuehecai  add for  fm
  160.         $add[$pf]=$expage.$add[$pf];
  161.         // add end
  162.         $n_r=explode($expage,$add[$pf]);
  163.         
  164.         $thispagenum=count($n_r);
  165.         //取得分页
  166.         $thefun=$public_r['textpagefun']?$public_r['textpagefun']:'sys_ShowTextPage';
  167.  
  168.         if(strstr($newstemptext,'[!--title.fm--]'))
  169.         {
  170.             for($j=2;$j<$thispagenum;$j++)
  171.             {
  172.               //    $spurl=eReturnRewritePageLink($pagefunr,$j);
  173.                 // $plink=$add[filename].'_'.$j.$filetype;
  174.                 
  175.                 if($j==0){
  176.                    $spurl=$dolink.$add[filename].".html";
  177.                 }else{
  178.                      $spurl=$dolink.$add[filename].'_'.$j.".html";
  179.                 }
  180.             
  181.                     $ti_r=explode('[/!--empirenews.page--]',$n_r[$j]);
  182.                     $sptitle='第'.($j-1).'章';
  183.             
  184.                 $select='';
  185.                 if($page==$j)
  186.                 {
  187.                     $ptitle=$sptitle;
  188.                     
  189.                 }
  190.                 $titleselect.='<li class="column4"><a href="'.$spurl.'">'.$sptitle.'</a></li>';
  191.             }
  192.             $titleselect='<ul class="list clearfix">'.$titleselect.'</ul>';
  193.         
  194.         }
  195.  
  196.         $file=$doclasspath.$newspath.$add[filename].$filetype;
  197.         $string=$newstempstr;//模板
  198.         //替换变量
  199.         $string=str_replace('[!--p.title--]',$add[title],$string);
  200.         $string=str_replace('[!--next.page--]','',$string);
  201.         $string=str_replace('[!--page.url--]','',$string);
  202.         $string=str_replace('[!--title.select--]','',$string);
  203.         $string=str_replace('[!--title.fm--]',$titleselect,$string);
  204.         //写文件
  205.         $murl=$mdolink.$add[filename].$filetype;
  206.         $string=str_replace('[--murl--]',$murl,$string);
  207.     return $string;
  208.     
  209.     
  210.     //mGetHtml($classid,$id,$add,1,1);
  211. }


tags: 帝国cms 插件 帝国
返回顶部
推荐资讯
视频:田纪钧讲关节不痛的秘密、膝关节拉筋法
视频:田纪钧讲关节不
白露到了,你还好吗?
白露到了,你还好吗?
尿疗与断食
尿疗与断食
给风疹反复发作女孩的药方(组图)
给风疹反复发作女孩的
相关文章
栏目更新
栏目热门
  1. libreoffice7的命令大全
  2. 帝国cms代码片段备忘录
  3. 帝国cms中点卡怎么可以直接用来网站的登录
  4. 帝国cms插件安装模板
  5. 帝国cms插件之标题生成标题图片
  6. 帝国cms全站搜索的分页格式如何修改-流程
  7. 帝国cms插件之迅搜
  8. php代码判断是不是微信内部浏览器
  9. useragent两千条,爬虫专用
  10. curl的使用集锦【php】