時(shí)間:2022-05-26 00:09:01 | 來源:網(wǎng)絡(luò)營銷
時(shí)間:2022-05-26 00:09:01 來源:網(wǎng)絡(luò)營銷
我們用織夢dedecms后臺管理系統(tǒng)制作網(wǎng)站的時(shí)候,點(diǎn)擊進(jìn)入每個(gè)欄目時(shí),都會有“關(guān)于我們”,“新聞中心”,“產(chǎn)品展示”等提示性的圖片,單獨(dú)調(diào)用這些圖片比較麻煩,對此,我們可以修改程序,實(shí)現(xiàn)每個(gè)欄目都有上傳欄目縮略圖的功能,就方便多了。alter table `dede_arctype` add `typeimg` char(100) NOT NULL default '';其中dede為表前綴,若有做修改,請改為修改后的前綴。
`typeimg`='$typeimg',4、修改catalog_add.htm
<tr> <td height="65" style="padding-left:10px;">欄目圖片:</td> <td><input name="typeimg" type="text" style="width:250px" id="typeimg" class="alltxt" value="" /> <input type="button" name="set9" value="瀏覽... "class="coolbg np" style="width:60px" onClick="SelectTemplets('SelectImage('form1.typeimg','small');" />(欄目模板里用{dede:field.typeimg /}調(diào)用) </td> </tr>效果如圖:
<script language='javascript' src="js/main.js"></script>效果如圖:
<tr> <td height="65" style="padding-left:10px;">欄目圖片:</td> <td><input name="typeimg" type="text" style="width:250px" id="typeimg" class="alltxt" value="<?php echo $myrow['typeimg']?>" /><input type="button" name="set9" value="瀏覽... "class="coolbg np" style="width:60px" onClick="SelectImage('form1.typeimg','small');" />(欄目模板里用{dede:field.typeimg /}調(diào)用) </td> </tr>效果如圖:
<script language='javascript' src="js/main.js"></script>6、channel.lib.php
alter table `dede_arctype` add `typeimg` varchar(200) NOT NULL default ;其中dede為表前綴,若有做修改,請改為修改后的前綴。
$queryTemplate = "INSERT INTO `ma_arctype`將
(reid,topid,sortrank,typename,typedir,替換為:
(reid,topid,sortrank,typename,typedir,typeimg,將
('~reid~','~topid~','~rank~','~typename~','~typedir~',替換為:
('~reid~','~topid~','~rank~','~typename~','~typedir~','~typeimg~',查找
$in_query = "INSERT INTO `ma_arctype`將
(reid,topid,sortrank,typename,typedir,替換為:
(reid,topid,sortrank,typename,typedir,typeimg,將
('$reid','$topid','$sortrank','$typename','$typedir',替換為:
('$reid','$topid','$sortrank','$typename','$typedir','$typeimg',修改完畢后,保存catalog_add.php,上傳覆蓋原文件。
$upquery = "UPDATE `ma_arctype` SET在typedir='$typedir',其下面增加一行:
`typeimg`='$typeimg',修改完畢后,保存catalog_edit.php,上傳覆蓋原文件。
<title>欄目管理</title> <link href=”css/base.css” rel=”stylesheet” type=”text/css”>添加js文件,為:
<title>欄目管理</title> <link href=”css/base.css” rel=”stylesheet” type=”text/css”> <script language=”javascript” src=”../include/js/dedeajax2.js”></script> <script language=’javascript’ src=”js/main.js”></script> <script type=”text/javascript” src=”js/calendar/calendar.js”></script>查找:
<tr> <td height="26" style="padding-left:10px;">列表命名規(guī)則:</td> <td> <input name="namerule2" type="text" id="namerule2" value="{typedir}/list_{tid}_{page}.html" class="pubinputs" style="width:250px" /> <img src="images/help.gif" alt="幫助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar3')"/></td> </tr>在標(biāo)簽下面增加一行:
<!--增加欄目縮略圖--> <tr> <td width="90" style="padding-left:10px;">欄目圖片:</td> <td width="560"> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td height="30"> <input name="typeimg" type="text" id="typeimg" style="width:240px" /> <input type="button" value="本地上傳" style="width:70px;cursor:pointer;display:none" /> <iframe name='uplitpicfra' id='uplitpicfra' src='' style='display:none'></iframe> <span class="litpic_span"><input name="litpic" type="file" id="litpic" onChange="SeePicNew(this, 'divpicview', 'uplitpicfra', 165, 'archives_add.php');" size="1" class='np coolbg'/></span> <input type="button" name="Submit2" value="選擇圖片" style="margin-left:8px;" onClick="SelectImage('form1.typeimg','small');" class='np coolbg'/> <input type="button" name="Submit2" value="裁剪" style="margin-left:8px;" onClick="imageCut('typeimg');" class='np coolbg'/> <input type='checkbox' class='np' name='ddisremote' value='1' id='ddisremote'/>遠(yuǎn)程<br />(欄目模板里用{dede:field.typeimg /}調(diào)用 </td> </tr> </table> </td> <td width="150" align="center"> <div id='divpicview' class='divpre'></div> </td> </tr> <!--增加欄目縮略圖-->修改完畢后,保存catalog_add.htm,上傳覆蓋原文件。
<title>欄目管理</title> <link href=”css/base.css” rel=”stylesheet” type=”text/css”>添加js文件,為:
<title>欄目管理</title> <link href=”css/base.css” rel=”stylesheet” type=”text/css”> <script language=”javascript” src=”../include/js/dedeajax2.js”></script> <script language=”javascript” src=”js/main.js”></script> <script type=”text/javascript” src=”js/calendar/calendar.js”></script>查找
<tr> <td height="26" style="padding-left:10px;">列表命名規(guī)則:</td> <td> <input name="namerule2" type="text" id="namerule2" value="<?php echo $myrow['namerule2']?>" size="40" class="iptxt" /> <img src="images/help.gif" alt="幫助" width="16" height="16" border="0" style="cursor:pointer" onClick="ShowHide('helpvar3')"/></td> </tr>在其下面增加一行:
<!--增加欄目縮略圖--> <tr> <td width="90" height="81" style="padding-left:10px;">欄目圖片:</td></td> <td width="500"> <input name="typeimg" type="text" id="typeimg" style="width:300px" value="<?php echo $myrow['typeimg']?>"><input type="button" name="Submit" value="瀏覽..." style="width:70px" onClick="SelectImage('form1.typeimg','');"> <input type="button" name="Submit2" value="裁剪" style="margin-left:8px;" onClick="imageCut('typeimg');" class='np coolbg'/> <input type='checkbox' class='np' name='ddisremote' value='1'> 遠(yuǎn)程<br />(欄目模板里用{dede:field.typeimg /}調(diào)用) </td> <td align="center"> <img src="<?php if($myrow['typeimg']!="") echo $myrow['typeimg']; else echo "images/pview.gif";?>" width="150" height="100" id="picview" name="picview"> </td> </tr> <!--增加欄目縮略圖-->修改完畢后,保存catalog_edit.htm,上傳覆蓋原文件。
if($type=='top') { $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="son") { //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid']; if($typeid==0) { return ''; } $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="self") { if($reid==0) { return ''; } $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row"; }替換成:
if($type=='top') { $sql = "Select id,typename,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="son") { //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid']; if($typeid==0) { return ''; } $sql = "Select id,typename,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row"; } else if($type=="self") { if($reid==0) { return ''; } $sql = "Select id,typename,typeimg,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row"; }7、調(diào)用方法
if($this->ChannelUnit->ChannelInfos['issystem']!=-1)將
$query = “Select arc.*,tp.reid,tp.typedir,ch.addtable from `dede_archives` arc left join dede_arctype tp on tp.id=arc.typeid left join dede_channeltype as ch on arc.channel = ch.id where arc.id=’$aid’ “; $this->Fields = $this->dsql->GetOne($query);替換為:
$query = “Select arc.*,tp.reid,tp.typedir,tp.typeimg,ch.addtable from `dede_archives` arc left join dede_arctype tp on tp.id=arc.typeid left join dede_channeltype as ch on arc.channel = ch.id where arc.id=’$aid’ “; $this->Fields = $this->dsql->GetOne($query);保存文件即可。
關(guān)鍵詞:定義,功能,調(diào)用
客戶&案例
關(guān)于我們
微信公眾號
版權(quán)所有? 億企邦 1997-2022 保留一切法律許可權(quán)利。