帝国cms 编辑器换成 ueditor 后如何使用取第一张图片为标题图片
ueditor 编辑器有个优势,就是复制文章的时候,可以自动保存远程文件到本地
但是帝国cms 换成ueditor 编辑器后 取第一张图片为标题图片的功能无法使用了
我们可以做如下修改
/e/data/html/1.php 文件(用哪个取决于你用的哪个模型了)
修改
<input name="getfirsttitlepic" type="text" id="getfirsttitlepic" value="" size="1">
为
<input name="getfirsttitlepic" type="text" id="getfirsttitlepic" value="1" size="1">
然后打开/web/e/class/hinfofun.php
修改
$firsttitlepic=GetFpicToTpic($add['classid'],$id,$add['getfirsttitlepic'],$add['getfirsttitlespic'],$add['getfirsttitlespicw'],$add['getfirsttitlespich'],$public_r['filedeftb']);
换成
$firsttitlepic= bodyimg( mystripslashes( $add['newstext'] ) );
这个样就可以实现 自动把第一张图作为标题图了
所用的自定义函数可以添加到 /e/class/userfun.php
function bodyimg( $obj ){ if ( isset( $obj ) ) { if ( preg_match( "", $obj, $regs ) ) { return $obj = $regs[1]; } } else { return FALSE; }}function mystripslashes( $string ){ if ( !is_array( $string ) ) { return stripslashes( $string ); } foreach ( $string as $key => $val ) { $string[$key] = new_stripslashes( $val ); } return $string;}

帝国cms 编辑器换成 ueditor 后如何使用取第一张图片为标题图片标题图片