DEDECMS內容圖片如何在二級域名下調用的解決方法
2024-07-12 08:27:47
供稿:網友
dedecmsSYSTEM_配置參數->其它選項中有兩個配置選項:[附件目錄是否綁定為指定的二級域名|附件目錄的二級域名]很明顯示官方早就注意到了在二級域名下的各種子問題!解決辦法: 我們現在打開include/FCKeditor/editor/dialog/目錄下的文件:“dede_image.php”! 找到下面的代碼 if($cfg_multi_site=='N') { $imghtml.="<imgsrc=/"$imgsrcValue/"width=/"$imgwidthValue/"border=/"0/"height=/"$imgheightValue/"alt= /"$altname/"style=/"cursor:pointer/"onclick=/"window.open('$urlValue')/"/><br/>/r/n"; } else { if(empty($cfg_basehost))$cfg_basehost='http://'.$_SERVER["HTTP_HOST"]; $imgHtml.="<imgsrc=/"$imgsrcValue/"width=/"$imgwidthValue/"border=/"0/"height= /"$imgheightValue/"alt=/"$altname/"style=/"cursor:pointer/"onclick=/"window.open('$urlValue')/"/><br/>/r/n"; } 吧代碼改成下面的代碼 if($GLOBALS['cfg_addon_domainbind']){$addon_domain=$GLOBALS['cfg_addon_domain'];} if($cfg_multi_site=='N') { $imgHtml.="<imgsrc=/"{$addon_domain}{$imgsrcValue}/"width=/"$imgwidthValue/"border=/"0/"height=/"$imgheightValue/"alt= /"$altname/"style=/"cursor:pointer/"onclick=/"window.open('{$addon_domain}{$urlValue}')/"/><br/>/r/n"; } else { if(empty($cfg_basehost))$cfg_basehost='http://'.$_SERVER["HTTP_HOST"]; $imgHtml.="<imgsrc=/"{$addon_domain}{$imgsrcValue}/"width=/"$imgwidthValue/"border=/"0/"height=/"$imgheightValue/"alt= /"$altname/"style=/"cursor:pointer/"onclick=/"window.open('{$addon_domain}{$urlValue}')/"/><br/>/r/n"; } 看看,現在上傳的圖片正常了吧,接下來咱們要考慮的是下面不是有一個“瀏覽服務器_”的按紐嗎,[圖片/隨便/flash/多媒體]都有這個功能! 我們先打開include/dialog/目錄下的select_images.php|select_media.php|select_soft.php|select_templets.php 將下面的代碼: $activeurl='..'.$activepath; 改成以下的代碼 if($GLOBALS['cfg_addon_domainbind']){$addon_domain=$GLOBALS['cfg_addon_domain'];} $activeurl='..'.$addon_domain.$activepath; 現在我們已經完成所以的更改,這樣更改是在保證織夢cms內容管理SYSTEMSYSTEM_的完整性上改的,只有內容中的圖片才會變!當然前提是你要開啟:附件目錄是否綁定為指定的二級域名而且指定二級域名地址。