We are making Dream weaving template Usually, there are "About Us", "News Center" and other columns. If you want each column to display different pictures, you can modify it according to the following method, so that each column has the function of uploading column thumbnails.
Step 1: Execute the SQL command to add a field to the column table structure of the database
alter table `dede_arctype` add `typeimg` varchar(200) NOT NULL default ;
Step 2: Modify the files involved:
dede/catalog_add.php
dede/catalog_edit.php
dede/templets/catalog_add.htm
dede/templets/catalog_edit.htm
include/taglib/channel.lib.php
1. Open the dede/catalog_add.php file and search for
$queryTemplate = “insert into `dede_arctype`
take
(reid,topid,sortrank,typename,typedir,
Replace with:
(reid,topid,sortrank,typename,typedir,typeimg,
take
(‘~reid~’,'~topid~’,'~rank~’,'~typename~’,'~typedir~’,
Replace with:
(‘~reid~’,'~topid~’,'~rank~’,'~typename~’,'~typedir~’,'~typeimg~’,
lookup
$in_query = “INSERT INTO `dede_arctype`
take
(reid,topid,sortrank,typename,typedir,
Replace with:
(reid,topid,sortrank,typename,typedir,typeimg,
take
(‘$reid’,'$topid’,'$sortrank’,'$typename’,'$typedir’,
Replace with:
(‘$reid’,'$topid’,'$sortrank’,'$typename’,'$typedir’,'$typeimg’,
Save catalog_add.php.
2. Open the dede/catalog_edit.php file and search for
$upquery = “Update `dede_arctype` set
Add a line below typedir='$typedir':
`typeimg`=’$typeimg’,
Save catalog_edit.php.
3. Open the dede/templates/catalog_add.htm file
Find this code at the top
<title>Column management</title>
<link href=”css/base.css” rel=”stylesheet” type=”text/css”>
Replace with:
<title>Column management</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>
lookup
<tr>
<td height="26" style="padding left: 10px;">List naming rules:</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="Help" width="16" height="16" border="0" style="cursor: pointer" onClick="ShowHide ('helppar3 ')"/>
</td>
</tr>
Add a line below the label:
<!-- Add column thumbnail -->
<tr>
<td width="90" style="padding left: 10px;">Column pictures:</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="Upload locally" 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="Select a picture" style="margin left: 8px;" onClick="SelectImage ('form1. typeimg ',' small ');" class='np coolbg'/>
<input type="button" name="Submit2" value="Crop" style="margin left: 8px;" onClick="imageCut ('typeimg ');" class='np coolbg'/>
<input type='checkbox 'class='np' name='disremote 'value='1' id='disremote '/>Remote<br/>(called with {de: field. typeimg/} in the column template
</td>
</tr>
</table>
</td>
<td width="150" align="center">
<div id='divpicview' class='divpre'></div>
</td>
</tr>
<!-- Add column thumbnail -->
Save catalog_add.htm.
4. Open the dede/templates/catalog_edit.htm file
Find this code at the top
<title>Column management</title>
<link href=”css/base.css” rel=”stylesheet” type=”text/css”>
Replace with:
<title>Column management</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>
lookup
<tr>
<td height="26" style="padding left: 10px;">List naming rules:</td>
<td>
<input name="namerule2" type="text" id="namerule2" value="<?php echo $myrow['namerule2']?>" size="40" class="iptxt" />
<img src="images/help. gif" alt="Help" width="16" height="16" border="0" style="cursor: pointer" onClick="ShowHide ('helppar3 ')"/>
</td>
</tr>
Add a line below it:
<!-- Add column thumbnail -->
<tr>
<td width="90" height="81" style="padding left: 10px;">Column pictures:</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="Browse..." style="width: 70px" onClick="SelectImage ('form1. typeimg', '');">
<input type="button" name="Submit2" value="Crop" style="margin left: 8px;" onClick="imageCut ('typeimg ');" class='np coolbg'/>
<input type='checkbox 'class='np' name='disremote 'value='1'>Remote<br/>(called with {de: field. typeimg/} in the column template)
</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>
<!-- Add column thumbnail -->
So far, the modification has been completed!
When adding or modifying a column picture, the selection of adding a column picture will automatically appear in (Column Management>Advanced Options). Click to select a picture, and then select Browse and Upload in the pop-up window.
Note: When calling the foreground column label, you need to change a file to display the column image. Otherwise, you can only display the image through SQL statements.
Step 3: Call thumbnail of list page
Open: include/taglib/channel.lib.php
find
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";
}
Replace with the following:
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";
}
Call method:
<img src=”[field:typeimg /]” />
Step 4: Call and search the thumbnail of the article content page
if($this->ChannelUnit->ChannelInfos['issystem']!=-1)
take
$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);
Replace with:
$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);
Save the file.
Statement: All articles on this site, unless otherwise specified or marked, are originally published on this site. No individual or organization is allowed to copy, embezzle, collect and publish the content of this website to any website, book and other media platforms without the consent of this website. If the content of this website infringes upon the legitimate rights and interests of the original author, please contact us for handling.