您现在的位置是:首页 > cms教程 > DedeCMS教程DedeCMS教程
织梦cms栏目绑定二级域名后图片不显示路径错误的解决方法
若烟2024-02-25DedeCMS教程已有人查阅
导读织梦CMS栏目管理-高级选项里有绑定域名功能,可以让我们用一级或二级域名绑定栏目来访问,但是有个问题就是栏目绑定二级域名后图片不显示,路径错误
织梦CMS栏目管理-高级选项里有绑定域名功能,可以让我们用一级或二级域名绑定栏目来访问,但是有个问题就是栏目绑定二级域名后图片不显示,路径错误,解决这个问题需要修改程序代码来解决。
修改方法如下:
将 dede/INC 的inc_archives_functions.php 文件改为如下代码就OK了
代码:
修改方法如下:
将 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;
}
//本地缩略
else{
//本地大图强制生成本地图缩略
if($litpic=='ddfirst' && !eregi("^http://",$picname)){
$oldpic = $cfg_basedir.$picname;
if(!eregi('_lit',$litpic)){
$litpic = str_replace('.','_lit.',$picname);
$saveinfo = true;
}
@ImageResize($oldpic,$cfg_ddimg_width,$cfg_ddimg_height,$cfg_basedir.$litpic);
}else{
$litpic = $picname;
}
}
}
$imgfile = $cfg_basedir.$litpic;
if($saveinfo && is_file($imgfile) && $litpic!=''){
$info = "";
$imginfos = GetImageSize($imgfile,$info);
//把新上传的图片信息保存到媒体文档管理档案中
$inquery = "
INSERT INTO dede_uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('{$title} 图','$litpic','1','".$imginfos[0]."','".$imginfos[1]."','0','".filesize($imgfile)."','".time()."','".$cuserLogin->getUserID()."','0');
";
$dsql = new DedeSql();
$dsql->ExecuteNoneQuery($inquery);
}
return $litpic;
}
//检测栏目是否设置了浏览权限
function GetCoRank($arcrank,$typeid){
$dsql = new DedeSql(false);
$row = $dsql->GetOne("Select corank From dede_arctype where ID='$typeid' ");
if($row['corank']!=0) return $row['corank'];
else return $arcrank;
}
//图集里大图的小图
function GetImageMapDD($filename,$ddm,$oldname=''){
if($oldname!='' && !eregi("^http://",$oldname)){
$ddpicok = $oldname;
}else{
$ddn = substr($filename,-3);
$ddpicok = ereg_replace("\.".$ddn."$","-lp.".$ddn,$filename);
}
$toFile = $GLOBALS['cfg_basedir'].$ddpicok;
ImageResize($GLOBALS['cfg_basedir'].$filename,$ddm,300,$toFile);
return $ddpicok;
}
//------------------------
//上传一个未经处理的图片
//------------------------
/*
//参数一 upname 上传框名称
//参数二 handurl 手工填写的网址
//参数三 ddisremote 是否下载远程图片 0 不下, 1 下载
//参数四 ntitle 注解文字 如果表单有 title 字段可不管
*/
function UploadOneImage($upname,$handurl='',$ddisremote=1,$ntitle='')
{
global $cuserLogin,$cfg_basedir,$cfg_image_dir,$dsql,$title;
if($ntitle!='') $title = $ntitle;
$ntime = time();
$filename = '';
$isrm_up = false;
$handurl = trim($handurl);
//如果用户自行上传了图片
if(!empty($_FILES[$upname]['tmp_name']) && is_uploaded_file($_FILES[$upname]['tmp_name']))
{
$istype = 0;
$sparr = Array("image/pjpeg","image/jpeg","image/gif","image/png");
$_FILES[$upname]['type'] = strtolower(trim($_FILES[$upname]['type']));
if(!in_array($_FILES[$upname]['type'],$sparr)){
ShowMsg("洗图片式使JPEGGIFPNG式一郑","-1");
exit();
}
if(!empty($handurl) && !eregi("^http://",$handurl) && file_exists($cfg_basedir.$handurl) ){
if(!is_object($dsql)) $dsql = new DedeSql();
$dsql->ExecuteNoneQuery("Delete From dede_uploads where url like '$handurl' ");
$fullUrl = eregi_replace("\.([a-z]*)$","",$handurl);
}else{
$savepath = $cfg_image_dir."/".strftime("%Y-%m",$ntime);
CreateDir($savepath);
$fullUrl = $savepath."/".strftime("%d",$ntime).dd2char(strftime("%H%M%S",$ntime).'0'.$cuserLogin->getUserID().'0'.mt_rand(1000,9999));
}
if(strtolower($_FILES[$upname]['type'])=="image/gif") $fullUrl = $fullUrl.".gif";
else if(strtolower($_FILES[$upname]['type'])=="image/png") $fullUrl = $fullUrl.".png";
else $fullUrl = $fullUrl.".jpg";
//保存
@move_uploaded_file($_FILES[$upname]['tmp_name'],$cfg_basedir.$fullUrl);
$filename = $fullUrl;
//水印
@WaterImg($imgfile,'up');
$isrm_up = true;
}
//远程或选择本地图片
else{
if($handurl=='') return '';
//远程图片并要求本地化
if($isremote==1 && eregi("^http://",$handurl)){
$ddinfos = GetRemoteImage($handurl,$cuserLogin->getUserID());
if(!is_array($ddinfos)) $litpic = "";
else $filename = $ddinfos[0];
$isrm_up = true;
//本地图片或远程不要求本地化
}else{
$filename = $handurl;
}
}
$imgfile = $cfg_basedir.$filename;
if(is_file($imgfile) && $isrm_up && $filename!=''){
$info = "";
$imginfos = GetImageSize($imgfile,$info);
//把新上传的图片信息保存到媒体文档管理档案中
$inquery = "
INSERT INTO dede_uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('$title','$filename','1','".$imginfos[0]."','".$imginfos[1]."','0','".filesize($imgfile)."','".time()."','".$cuserLogin->getUserID()."','0');
";
$dsql = new DedeSql(false);
$dsql->ExecuteNoneQuery($inquery);
}
return $filename;
}
//------------------
//取第一个图片为缩略图
//------------------
function GetDDImgFromBody(&$body)
{
$litpic = '';
preg_match_all("/(src|SRC)=[\"|'| ]{0,}(.*\.(gif|jpg|jpeg|bmp|png))/isU",$body,$img_array);
$img_array = array_unique($img_array[2]);
if(count($img_array)>0){
$picname = preg_replace("/[\"|'| ]{1,}/","",$img_array[0]);
if(ereg("_lit\.",$picname)) $litpic = $picname;
else $litpic = GetDDImage('ddfirst',$picname,0);
}
return $litpic;
}
//获得一个附加表单
//-----------------------------
function GetFormItemA($ctag)
{
return GetFormItem($ctag,'admin');
}
//---------------------------
//处理不同类型的数据
//---------------------------
function GetFieldValueA($dvalue,$dtype,$aid=0,$job='add',$addvar='')
{
return GetFieldValue($dvalue,$dtype,$aid,$job,$addvar,'admin');
}
//获得带值的表单(编辑时用)
//-----------------------------
function GetFormItemValueA($ctag,$fvalue)
{
return GetFormItemValue($ctag,$fvalue,'admin');
}
//载入自定义表单(用于发布)
function PrintAutoFieldsAdd(&$fieldset,$loadtype='all')
{
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field","<",">");
$dtp->LoadSource($fieldset);
$dede_addonfields = "";
if(is_array($dtp->CTags))
{
foreach($dtp->CTags as $tid=>$ctag)
{
if($loadtype!='autofield'
|| ($loadtype=='autofield' && $ctag->GetAtt('autofield')==1) )
{
$dede_addonfields .= ( $dede_addonfields=="" ? $ctag->GetName().",".$ctag->GetAtt('type') : ";".$ctag->GetName().",".$ctag->GetAtt('type') );
echo GetFormItemA($ctag);
}
}
}
echo "<input type='hidden' name='dede_addonfields' value=\"".$dede_addonfields."\">\r\n";
}
//载入自定义表单(用于编辑)
function PrintAutoFieldsEdit(&$fieldset,&$fieldValues,$loadtype='all')
{
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field","<",">");
$dtp->LoadSource($fieldset);
$dede_addonfields = "";
if(is_array($dtp->CTags))
{
foreach($dtp->CTags as $tid=>$ctag)
{
if($loadtype!='autofield'
|| ($loadtype=='autofield' && $ctag->GetAtt('autofield')==1) )
{
$dede_addonfields .= ( $dede_addonfields=='' ? $ctag->GetName().",".$ctag->GetAtt('type') : ";".$ctag->GetName().",".$ctag->GetAtt('type') );
echo GetFormItemValueA($ctag,$fieldValues[$ctag->GetName()]);
}
}
}
echo "<input type='hidden' name='dede_addonfields' value=\"".$dede_addonfields."\">\r\n";
}
function getfilenameonly($arcid, $typeid, $senddate, $title, $ismake, $arcrank, $money)
{
global $dsql;
require_once DEDEINC.'/inc_channel_unit_functions.php';
$row = $dsql->getone("select namerule, typedir, siterefer, sitepath ,channeltype from dede_arctype where ID='$typeid'");
if(is_array($row)){
if($row['channeltype'] == -2) return $GLOBALS['cfg_plus_dir']."/view.php?aid=$arcid";
$filename = GetFileNewName($arcid, $typeid, $senddate, $title, $ismake, $arcrank, $row['namerule'],
$row['typedir'],$money,$row['siterefer'], $row['sitepath']);
}else{
showmsg('目id','-1');
exit;
}
if($filename=="") $filename = $GLOBALS['cfg_plus_dir']."/view.php?aid=$arcid";
return $filename;
}
?>
本文标签:
很赞哦! ()
图文教程
织梦提示你所选择的栏目与当前模型不相符,请选择白色的选项!
第一种:在后台发布信息的时候提示:在dedecms栏目中添加文章时,有时候dedecms会提示:你所选择的栏目与当前模型不相符,请选择白色的选项!
dedecms织梦数据库类使用方法$dsql解释
dedecms的数据库操作类,非常实用,在二次开发中尤其重要。引入common.inc.php文件require_once (dirname(__FILE
dede织梦不能生成栏目页的原因和解决方法
如果遇到dede不能生成栏目页,刚碰到这样的问题,点生成父栏目页没有反应,一直显示等待响应,因为其它页面都可以正常生成,所以我排除模板的问题。开始我以为是
织梦cms自动提取关键字无法关闭的解决方法
本文主要讲解织梦dedecms自动提取关键字无法关闭的解决方法登录后台-->系统-->系统基本参数-->其他选项-->自动提取关键字-->否。如此操作之后
相关源码
-
(自适应手机端)英文外贸电子产品通用pbootcms模板源码下载为电子产品外贸企业设计的响应式网站模板,采用PbootCMS开发内核,支持多语言展示。模板默认集成产品展示系统、询价表单模块和企业资质展示区,满足跨境贸易基础需求。整站采用模块化设计,便于扩展业务场景。查看源码 -
(自适应)蓝色自动溶剂萃取仪器设备类网站pbootcms模板下载本模板为溶剂萃取设备、实验室仪器等精密仪器行业设计,采用PbootCMS内核开发,具有高度专业性和行业适配性。模板设计充分考虑了仪器设备行业展示需求,能够呈现各类精密仪器的技术参数、应用场景和解决方案。查看源码 -
自适应新闻资讯技术博客个人网站pbootcms模板该模板基于PbootCMS开源内核深度开发,该模板适用于游戏新闻网站、游戏博客等企业或个人网站,新闻资讯技术博客pbootcms模板;采用六级分辨率断点适配技术查看源码 -
(自适应响应式)HTML5磁电机械设备蓝色营销型网站pbootcms模板本模板为磁电设备行业设计,采用蓝色营销风格,突出工业设备的专业性和技术感。模板结构清晰,能够有效展示磁电设备的技术参数、应用场景和企业实力,帮助客户快速了解产品特点和公司服务。查看源码 -
(自适应)工商代理公司注册财务会计pbootcms模板免费下载为工商代理、财务会计服务企业设计的网站模板,基于PbootCMS开发,充分考虑了企业服务行业的展示需求与客户转化路径。设计风格专业严谨,布局清晰合理,呈现企业服务内容与专业优势。查看源码 -
粉色家政月嫂保姆公司pbootcms网站模板(PC+WAP)为家政服务、月嫂保姆企业打造的营销型解决方案,基于PbootCMS内核开发,采用温馨粉色主题传递行业温度。PHP7.0+高性能架构支持SQLite/MySQL双数据库查看源码
| 分享笔记 (共有 篇笔记) |
