DEDECMS內容圖片在二級域名下調用的方法

字號:


    DedeCmsSYSTEM_配置參數(shù)->其它選項中有兩個配置選項:[附件目錄是否綁定為指定的二級域名|附件目錄的二級域名]很明顯示官方早就注意到了在二級域名下的各種子問題!
    打開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/>rn";
    }
    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/>rn";
    }
    改成下面
    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/>rn";
    }
    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/>rn";
    }
    現(xià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_的完整性上改的,只有內容中的圖片才會變!
    當然前提是你開啟:附件目錄是否綁定為指定的二級域名而且指定二級域名地址!