中药方大全小图标
您当前的位置:首页 > 其他 > 网站日记

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

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

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

代码备忘:

jiuhecai   封面

1. 新建一个内容模板,用于显示小说封面,记下这个模板的id

2. 在模板里,用标签 [!--title.fm--]  来显示章节

3. 本插件位置  /e/extend/jhcFM/

4.  修改 /e/class/funciton.php 

    4.1查找   if($j==1){
 
   在其中  $murl=$mdolink.$add[filename].$filetype;之后 插入
   
     include_once ECMS_PATH."/e/extend/jhcFM/nrfm.php";
     $string=GetHtmlFM($classid,$id,$add,$ecms,$doall);
     
     4.2 查找
    
     if($pf&&strstr($add[$pf],$expage))
     在其中插入
     
      //jiuehecai  add for  fm
        $add[$pf]=$expage.$add[$pf];
    // add end

 函数备忘:

//生成内容封面文件

function GetHtmlFM($classid,$id,$add,$ecms=0,$doall=0){
    global $public_r,$class_r,$class_zr,$fun_r,$empire,$dbtbpre,$emod_r,$class_tr,$level_r,$etable_r,$mob_r;
    $_POST[newstempid]=12;// 此处根据内容的封面模板id实际数值修改。
//  include_once ECMS_PATH."/e/extend/jhcFM/nrfm.php"; 
    $mid=$class_r[$classid]['modid'];
    $tbname=$class_r[$classid][tbname];
    
    if(InfoIsInTable($tbname))//内部表
    {
        return '';
    }

    
    $add['id']=$id;
    $add['classid']=$classid;
    if($add['isurl'])
    {
        return '';
    }
    if(empty($doall))
    {
        if(!$add['stb']||$class_r[$add[classid]][showdt]==2||strstr($public_r['nreinfo'],','.$add['classid'].','))//不生成
        {
            return '';
        }
    }
    //副表

    //路径
    $iclasspath=ReturnSaveInfoPath($add[classid],$add[id]);
    $doclasspath=eReturnTrueEcmsPath().$iclasspath;//moreport
    $createinfopath=$doclasspath;
    //建立日期目录
    $newspath='';
    if($add[newspath])
    {
        $createpath=$doclasspath.$add[newspath];
        if(!file_exists($createpath))
        {
            $r[newspath]=FormatPath($add[classid],$add[newspath],1);
        }
        $createinfopath.=$add[newspath].'/';
        $newspath=$add[newspath].'/';
    }
    
    //新建存放目录
    if($class_r[$add[classid]][filename]==3)
    {
        $createinfopath.=ReturnInfoSPath($add['filename']);
        DoMkdir($createinfopath);
        $fn3=1;
    }
    
    //存文本
    if($emod_r[$mid]['savetxtf'])
    {
        $stf=$emod_r[$mid]['savetxtf'];
        if($add[$stf])
        {
            //$add[$stf]=GetTxtFieldText($add[$stf]);
        }
    }

    $GLOBALS['navclassid']=$add[classid];
    $GLOBALS['navinfor']=$add;
    
    //取得内容模板
    //$add[newstempid]=$add[newstempid]?$add[newstempid]:$class_r[$add[classid]][newstempid];
    // 修改配置
    $add[newstempid]=$_POST[newstempid];
    $newstemp_r=$empire->fetch1("select temptext,showdate from ".GetTemptb("enewsnewstemp")." where tempid='$add[newstempid]' limit 1");
    $newstemp_r['tempid']=$add['newstempid'];
    if($public_r['opennotcj'])//启用反采集
    {
        $newstemp_r['temptext']=ReturnNotcj($newstemp_r['temptext']);
    }
    $newstemptext=$newstemp_r[temptext];
    $formatdate=$newstemp_r[showdate];
    //文件类型/权限
    if($add[groupid]||$class_r[$add[classid]]['cgtoinfo'])
    {
        if(empty($add[newspath]))
        {
            $include='';
        }
        else
        {
            $pr=explode('/',$add[newspath]);
            for($i=0;$i<count($pr);$i++)
            {
                $include.='../';
            }
        }
        if($fn3==1)
        {
            $include.='../';
        }
        $pr=explode('/',$iclasspath);
        $pcount=count($pr);
        for($i=0;$i<$pcount-1;$i++)
        {
            $include.='../';
        }
        $include1=$include;
        $include.='e/class/CheckLevel.php';
        $filetype='.php';
        $addlevel="<?php
        define('empirecms','wm_chief');
        $check_tbname='".$class_r[$add[classid]][tbname]."';
        $check_infoid=".$add[id].";
        $check_classid=".$add[classid].";
        $check_path="".$include1."";
        require("".$include."");
        ?>";
    }
    else
    {
        $filetype=$class_r[$add[classid]][filetype];
        $addlevel='';
    }
    //取得本目录链接
    if($class_r[$add[classid]][classurl]&&$class_r[$add[classid]][ipath]=='')//域名
    {
        $dolink=$class_r[$add[classid]][classurl].'/'.$newspath;
    }
    else
    {
        $dolink=$public_r[newsurl].$iclasspath.$newspath;
    }
    $mdolink=$mob_r['msiteurl'].$iclasspath.$newspath;
    //返回替换验证字符
    $docheckrep=ReturnCheckDoRepStr();
    if($add[newstext])
    {
        if(empty($public_r['dorepword'])&&$docheckrep[3])
        {
            $add[newstext]=ReplaceWord($add[newstext]);//过滤字符
        }
        if(empty($public_r['dorepkey'])&&$docheckrep[4]&&!empty($add[dokey]))//替换关键字
        {
            $add[newstext]=ReplaceKey($add['newstext'],$add['classid']);
        }
        if($public_r['opencopytext'])
        {
            $add[newstext]=AddNotCopyRndStr($add[newstext]);//随机复制字符
        }
    }
    //返回编译
    $newstemptext=GetInfoNewsBq($classid,$newstemp_r,$add,$docheckrep);
    //分页字段
    $expage='[!--empirenews.page--]';//分页符
    $pf=$emod_r[$mid]['pagef'];
    
    //变量替换
    $newstempstr=$newstemptext;//模板
    // add by  jiuehcai 
    //jiuehecai  add for  fm
        $add[$pf]=$expage.$add[$pf];
        // add end
        $n_r=explode($expage,$add[$pf]);
        
        $thispagenum=count($n_r);
        //取得分页
        $thefun=$public_r['textpagefun']?$public_r['textpagefun']:'sys_ShowTextPage';

        if(strstr($newstemptext,'[!--title.fm--]'))
        {
            for($j=2;$j<$thispagenum;$j++)
            {
              //    $spurl=eReturnRewritePageLink($pagefunr,$j);
                // $plink=$add[filename].'_'.$j.$filetype;
                
                if($j==0){
                   $spurl=$dolink.$add[filename].".html";
                }else{
                     $spurl=$dolink.$add[filename].'_'.$j.".html";
                }
            
                    $ti_r=explode('[/!--empirenews.page--]',$n_r[$j]);
                    $sptitle='第'.($j-1).'章';
            
                $select='';
                if($page==$j)
                {
                    $ptitle=$sptitle;
                    
                }
                $titleselect.='<li class="column4"><a href="'.$spurl.'">'.$sptitle.'</a></li>';
            }
            $titleselect='<ul class="list clearfix">'.$titleselect.'</ul>';
        
        }

        $file=$doclasspath.$newspath.$add[filename].$filetype;
        $string=$newstempstr;//模板
        //替换变量
        $string=str_replace('[!--p.title--]',$add[title],$string);
        $string=str_replace('[!--next.page--]','',$string);
        $string=str_replace('[!--page.url--]','',$string);
        $string=str_replace('[!--title.select--]','',$string);
        $string=str_replace('[!--title.fm--]',$titleselect,$string);
        //写文件
        $murl=$mdolink.$add[filename].$filetype;
        $string=str_replace('[--murl--]',$murl,$string);
    return $string;
    
    
    //mGetHtml($classid,$id,$add,1,1);
}


tags: 帝国cms 插件 帝国
返回顶部
推荐资讯
视频:田纪钧讲关节不痛的秘密、膝关节拉筋法
视频:田纪钧讲关节不
白露到了,你还好吗?
白露到了,你还好吗?
尿疗与断食
尿疗与断食
给风疹反复发作女孩的药方(组图)
给风疹反复发作女孩的
相关文章
栏目更新
栏目热门
  1. 帝国cms全站搜索的分页格式如何修改-流程
  2. libreoffice7的命令大全
  3. 帝国cms插件之标题生成标题图片
  4. 帝国cms插件安装模板
  5. useragent两千条,爬虫专用
  6. 帝国cms插件如何兼容gbk和utf8
  7. 帝国cms插件之迅搜
  8. 帝国cms用户上传文件名的命名规则及修改方
  9. 帝国cms7.2函数大全
  10. 帝国cms代码片段备忘录