本教程主要功能就是把編輯器內的img a標簽等替換為mip標準格式
1、打開/e/class/userfun.php添加處理函數:function
NewsTextReplace(
$add
){
$add
[
'newstext'
] = preg_replace(
'/<img.*?src="(.*?)".*?>/is'
,
'<mip-img alt="" src="$1"></mip-img>'
,
stripslashes
(
$add
[
'newstext'
]));
$add
[
'newstext'
] = preg_replace(
'/<a.*?href="(.*?)".*?</a>/is'
,
'<a data-type="mip" data-title="'
.
$add
[
'title'
] .
'" href="$1"></a>'
,
$add
[
'newstext'
]);
$add
[
'newstext'
] =
addslashes
(
$add
[
'newstext'
]);
return
$add
;
}
打開/e/action/show.php搜索 $GLOBALS['navclassid'] = $r['classid'];
在前面添加代碼:
$r = NewsTextReplace( $r ); |
以上即可!
此函數可以處理所有此信息的字段內容。
更多的需要處理請參考處理函數自行改寫。
新聞熱點
疑難解答