西部数码主机 | 阿里云主机| 虚拟主机 | 服务器 | 返回乐道官网
当前位置: 主页 > php教程 > dedecms教程 >

解决织梦CMS栏目绑定二级域名后图片不显示,路径错误办法

时间:2017-03-28 08:11来源:未知 作者:好模板编辑 点击:
织梦dedeCMS栏目管理-高级选项里有绑定域名功能,可以让我们用一级或二级域名绑定栏目来访问,但是有个问题就是栏目绑定二级域名后图片不显示,路径错误,解决这个问题需要修改
织梦dedeCMS栏目管理-高级选项里有绑定域名功能,可以让我们用一级或二级域名绑定栏目来访问,但是有个问题就是栏目绑定二级域名后图片不显示,路径错误,解决这个问题需要修改程序代码来解决。
解决织梦CMS栏目绑定二级域名后图片不显示,路径错误办法
修改方法如下:
将 dede/INC 的inc_archives_functions.php 文件改为如下代码就OK了
代码:
<?php
require_once(DEDEADMIN."/../include/pub_httpdown.php");
require_once(DEDEADMIN."/../include/inc_photograph.php");
require_once(DEDEADMIN."/../include/pub_oxwindow.php");
require_once(DEDEADMIN."/../include/inc_tag_functions.php");
require_once(DEDEADMIN."/../include/inc_custom_fields.php");
//---------------------------
//HTML獠吭赐?
//---------------------
function GetCurContentAlbum($body,$rfurl,&$firstdd)
{
global $cfg_multi_site,$cfg_basehost,$ddmaxwidth,$cfg_basedir;
include_once(DEDEADMIN."/../include/pub_collection_functions.php");
if(empty($ddmaxwidth)) $ddmaxwidth = 150;
$rsimg = '';
$cfg_uploaddir = $GLOBALS['cfg_image_dir'];
$cfg_basedir = $GLOBALS['cfg_basedir'];
$basehost = "dede_arctype where ID='$typeid' ");
if($row['ispart']!=0 || $row['channeltype']!=$channelid) { return false; }
else { return true; }
}
//---------------
//检测档案权限
//---------------
function CheckArcAdmin($aid,$adminid)
{
$dsql = new DedeSql(false);
$row = $dsql->GetOne("Select adminid From dede_archives where ID='$aid' ");
if($row['adminid']!=$adminid) return false;
else return true;
}
//---------------
//文档自动分页
//---------------
function SpLongBody(&$mybody,$spsize,$sptag)
{
if(strlen($mybody)<$spsize) return $mybody;
$bds = explode('<',$mybody);
$npageBody = "";
$istable = 0;
$mybody = "";
foreach($bds as $i=>$k)
{
if($i==0){ $npageBody .= $bds[$i]; continue;}
$bds[$i] = "<".$bds[$i];
if(strlen($bds[$i])>6){
    $tname = substr($bds[$i],1,5);
    if(strtolower($tname)=='table') $istable++;
    else if(strtolower($tname)=='/tabl') $istable--;
    if($istable>0){ $npageBody .= $bds[$i]; continue; }
    else $npageBody .= $bds[$i];
}else{
    $npageBody .= $bds[$i];
}
if(strlen($npageBody)>$spsize){
    $mybody .= $npageBody.$sptag;
    $npageBody = "";
     }
}
if($npageBody!="") $mybody .= $npageBody;
return $mybody;
}
//-----------------------
//创建指定ID的文档
//-----------------------
function MakeArt($aid,$mkindex=true,$upcache=true)
{
global $cfg_makeindex,$cfg_basedir,$cfg_templets_dir,$cfg_df_style,$cfg_up_prenext,$typeid,$envs,$typeid;
include_once(DEDEADMIN."/../include/inc_archives_view.php");
if(!$upcache) $envs['nocache'] = true;
$arc = new Archives($aid);
$reurl = $arc->MakeHtml();
if($mkindex)
{
//更新上下篇文章
if($cfg_up_prenext=='Y' && !empty($typeid))
{
        $preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And ID>".($aid-1000)." And arcrank>-1 And typeid='$typeid' order by ID desc");
        $nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID>$aid And ID<".($aid+1000)." And arcrank>-1 And typeid='$typeid' order by ID asc");
     
       if(is_array($preRow)){
        $arc = new Archives($preRow['ID']);
           $arc->MakeHtml();
       }
       if(is_array($nextRow)){
       $arc = new Archives($nextRow['ID']);
          $arc->MakeHtml();
       }
}
//更新主页
if($cfg_makeindex=='Y')
{
    $pv = new PartView();
    $row = $pv->dsql->GetOne("Select * From dede_homepageset");
    $templet = str_replace("{style}",$cfg_df_style,$row['templet']);
    $homeFile = dirname(__FILE__)."/../".$row['position'];
      $homeFile = str_replace("\\","/",$homeFile);
      $homeFile = str_replace("//","/",$homeFile);
      $fp = fopen($homeFile,"w") or die("页募{$homeFile} 没写权蓿");
      fclose($fp);
      $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet);
      $pv->SaveToHtml($homeFile);
}
}
return $reurl;
}
//---------------------------
//上传缩略图
//--------------------------
/*
参数一
litpic 默认为上传表单的名称
值为 none\ddfirst 强制不查检上传
值为 ddfirst 则强制把已存在的本地图生成缩略图
参数二
picname 手工填写的图片路径
参数三
isremote 是否下载远程图片 0 为不下载, 1为下载到本地
*/
function GetDDImage($litpic,$picname,$isremote,$ntitle='')
{
global $cuserLogin,$cfg_ddimg_width,$cfg_ddimg_height;
global $cfg_basedir,$ddcfg_image_dir,$title,$dsql;
$ntime = time();
$saveinfo = false;
if($ntitle!='') $title = $ntitle;
$picname = trim($picname);
if(($litpic!='none'||$litpic!='ddfirst') &&
!empty($_FILES[$litpic]['tmp_name']) && is_uploaded_file($_FILES[$litpic]['tmp_name']))
//如果用户自行上传缩略图
{
      $istype = 0;
      $sparr = Array("image/pjpeg","image/jpeg","image/gif","image/png");
      $_FILES[$litpic]['type'] = strtolower(trim($_FILES[$litpic]['type']));
      if(!in_array($_FILES[$litpic]['type'],$sparr)){
      ShowMsg("洗图片式使JPEGGIFPNG式一郑","-1");
      exit();
     }
    
     if(!empty($picname) && !eregi("^http://",$picname) && file_exists($cfg_basedir.$picname) ){
     if(!is_object($dsql)) $dsql = new DedeSql();
         $dsql->ExecuteNoneQuery("Delete From dede_uploads where url like '$picname' ");
     $fullUrl = eregi_replace("\.([a-z]*)$","",$picname);
     }else{
        $savepath = $ddcfg_image_dir."/".strftime("%y%m%d",$ntime);
          CreateDir($savepath);
          $fullUrl = $savepath."/".dd2char(strftime("%H%M%S",$ntime).$cuserLogin->getUserID().mt_rand(1000,9999));
     }
     
      if(strtolower($_FILES[$litpic]['type'])=="image/gif") $fullUrl = $fullUrl.".gif";
      else if(strtolower($_FILES[$litpic]['type'])=="image/png") $fullUrl = $fullUrl.".png";
      else $fullUrl = $fullUrl.".jpg";
     
      @move_uploaded_file($_FILES[$litpic]['tmp_name'],$cfg_basedir.$fullUrl);
     $litpic = $fullUrl;
    
     @ImageResize($cfg_basedir.$fullUrl,$cfg_ddimg_width,$cfg_ddimg_height);
    
     $saveinfo = true;
    
}else{
     if($picname=='') return '';
     //远程缩略
     if($isremote==1 && eregi("^http://",$picname)){
        $ddinfos = GetRemoteImage($picname,$cuserLogin->getUserID());
        if(!is_array($ddinfos)) $litpic = "";
        else{
          $litpic = $ddinfos[0];
          if($ddinfos[1] > $cfg_ddimg_width || $ddinfos[2] > $cfg_ddimg_height){
             @ImageResize($cfg_basedir.$litpic,$cfg_ddimg_width,$cfg_ddimg_height);
          }
        }
        $saveinfo = true;
     }
(责任编辑:好模板)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
热点内容