操作方法如下:
1.把下面的代碼放到/e/class/userfun.php (放到最后?>的前面)
function?user_imgalt($mid,$f,$isadd,$isq,$value,$cs){$title=$_POST['title'];$htmls=$value;$pattern?=?"/
]+>/";?preg_match_all($pattern,?$htmls,?$matches);?for?($i=0;?$i<=count($matches[0]);?$i++)?{??preg_match_all("/alt=".+?"/",$matches[0][$i],$altimg);???preg_match_all("/title=".+?"/",$matches[0][$i],$titleimg);?$t_alt=count($altimg[0]);if($t_alt==0){$htmls=str_replace("![]()
2.在模型里正文字段一般是newstext(也可以是其它字段),在字段處理函數文本框填上user_imgalt 如下圖:
3.這樣在帝國cms后臺發布信息的時候就可以自動替換圖片alt和title屬性為信息標題了!
新聞熱點
疑難解答