unset($row);下面,大概253行添加如下代码:
$content = $this->replacePicUrl($this->Fields['body'], $GLOBALS['cfg_basehost']); $content_arr = $this->getStyle($content); $this->Fields['body'] = $content_arr['content']; $this->Fields['style_custom'] = $content_arr['style_custom'];
(3)、找到函数MakeHtml($isremote=0),大概358行,在里面的
$this->Fields['filename'] = empty($this->Fields['filename'])? '' : $this->Fields['filename'];下面添加如下代码:
$this->Fields['style_custom'] = empty($this->Fields['style_custom'])? '' : $this->Fields['style_custom']; (4)、在templete的article_article.htm模板中的head标签内添加如下代码: <style mip-custom> {dede:field.custom_style/} </style>
文章内链更换
注明:内链请勿填写绝对地址,还是在上面2、3的方法里面改,还是增加一个变量正则,然后替换。
function replaceurl($content){ $pattern = Array("/<img(.*?)src=('|")([^>]*).(bmp|gif|jpeg|jpg|png)('|")(.*?)>/i","/style=(.*?)>/i",'/<ab[^>]+bhref="([^"]*)"[^>]*>/i'); $replacement = Array("<mip-img popup src=http://www.dede58.com/$3.$4></mip-img>",">",'<a data-type="mip" href=http://mip.lol9.cn$1>'); $content = preg_replace($pattern, $replacement, $content); return $content; }
文章文档关键词链接更换
如果你用了织梦自带的关键字加链接,在核心》批量维护》文档关键词维护里面,那么就要替换成绝对地址与增加mip链接格式
打开include/arc.archives.class.php 文件 ,大概在1219行,在变量$key_url前面加上自己的链接,与href前面加上 data-type=mip
1
$query = "SELECT * FROM dede_keywords WHERE rpurl<>'' ORDER BY rank DESC"; $this->dsql->SetQuery($query); $this->dsql->Execute(); while($row = $this->dsql->GetArray()) { $key = trim($row['keyword']); $key_url=trim($row['rpurl']); $karr[] = $key; $kaarr[] = "<a data-type=mip href='$key_url'><u>$key</u></a>"; }