做網(wǎng)站的朋友可能會遇到這樣的問題,我們在用dedecms制作網(wǎng)站時,給欄目加縮略圖時,插入圖片,系統(tǒng)會自動加入好多<div><p>之類的代碼,其實我們想要的代碼只是一個<img>,這樣就很不方便,下面我給大家分享一下我的解決方法:
將include/FCKeditor/editor/dialog/dede_image.php中的
代碼改成如下代碼:
if($cfg_multi_site=='N')
{
$imgHtml .= "<img src='$imgsrcValue' width='$imgwidthValue' border='0' height='$imgheightValue' />";
}
else
{
if(empty($cfg_basehost)) $cfg_basehost = 'http://'.$_SERVER["HTTP_HOST"];
$imgHtml .= "<img src='{$cfg_basehost}$imgsrcValue' width='$imgwidthValue' border='0' height='$imgheightValue' />";
將其中的以下代碼刪掉:
$imgHtml .='<p>'
$imgHtml .='</p>'
var newCode = FCK.CreateElement('<div>');
代碼改成如下代碼:
var newCode = FCK.CreateElement('a');
或者用以下方法:
在模板頁面調(diào)用時,把<div>等代碼過濾掉
<img src=”[field:content function='ereg_replace("width=(.+)\"","",str_replace("<br />","",str_replace(" ","",str_replace("<div>","",str_replace("</div>","",str_replace("<p>","",str_replace("</p>","",str_replace("\" />","",ereg_replace("<img(.+)src=\"","",@me)))))))))'/]” alt=”[field:typename/]” />
轉(zhuǎn)載請注明出處:本文來自:http://www.hnscxh.com免備案空間、不需要備案空間、國內(nèi)月付空間,希望能與您合作共贏!
◎歡迎參與討論,請在這里發(fā)表您的看法、交流您的觀點。