-
WORD教程资讯类网站织梦...
-
幽默笑话搞笑趣图类网站...
-
重工机械设备制造类网站...
-
骑马培训课程外贸类网站...
-
美容化妆类网站织梦模板...
-
户外露营设备类网站织梦...
-
工商注册代理记账类网站...
-
智能家居生活类网站织梦...
-
画册包装设计类网站织梦...
-
时尚服装展示类网站织梦...
-
全屋定制全景案例类网站...
-
电容电阻电子器件类网站...
-
家居家具建材类网站织梦...
-
室内设计装修工程类网站...
-
电线电缆生产厂家类网站...
-
不锈钢金属制品厂家类企...
-
娱乐新闻资讯类网站织梦...
-
金属工艺品加工厂家类网...
-
电机制造减速电机设备类...
-
电梯扶梯研发类企业网站...
不用修改程序内核文件,不影响电脑站和手机站文章内容页的文章内容输出,增加个自定义方法来解决织梦MIP文章内容页图片适配百度MIP规范
- 操作步骤
- <img 替换成 <mip-img
- width|height 去除图片宽高
- style 去除内联样式
- /uploads/ 相对路径图片路径替换成绝对路径
打开 /include/extend.func.php 在最下面加入个方法
/*** MIP文章内容页图片适配百度MIP规范** @access public* @param string $content 文章内容* @return string*/function mip($content){global $cfg_basehost;preg_match_all('/<img (.*?)\>/', $content, $images);if(!is_null($images)) {foreach($images[1] as $index => $value){$mip_img = str_replace('<img', '<mip-img', $images[0][$index]);$mip_img = str_replace('>', '></mip-img>', $mip_img);$mip_img = preg_replace('/(width|height)="\d*"\s/', '', $mip_img );$mip_img = preg_replace('/ style=\".*?\"/', '',$mip_img);$content = str_replace($images[0][$index], $mip_img, $content);}}preg_match_all('/ style=\".*?\"/', $content, $style);if(!is_null($style)) {foreach($style[0] as $index => $value){$mip_style = preg_replace('/ style=\".*?\"/', '',$style[0][$index]);$content = str_replace($style[0][$index], $mip_style, $content);}}$content = str_replace('/uploads/', $cfg_basehost.'/uploads/', $content);return $content;}
内容页模板标签写法
{dede:field.body function=mip(@me)/}