Home CMS Tutorial DEDECMS How to use dedecms special template

How to use dedecms special template

Jan 13, 2020 am 09:38 AM
dedecms

How to use dedecms special template

How to use dedecms special template?

There is relatively little information on the topic of DeDeCms on bbs. I have consulted a lot of information before but could not find its solution

Recommended study: woven Dream cms

Wunai can only rely on his own efforts to make enough food and clothing; there is this passage in the official version:

1. The article list is separated in the form of ID1, ID2, ID3. The system will automatically exclude the same articles from different nodes;

2. Regarding the use of the [field:fieldname /] tag in a single record template, please refer to the description of the arclist tag in the system help;

3. Node ID is the unique identifier of the node. It is allowed to use {dede:specnote id='identity'/} to represent a single node in the topic template.

4. Under normal circumstances, each node displays the documents in the "Node Article List". If you specify "automatic acquisition mode", you must specify the keyword and column ID.

However, after testing {dede:specnote id='note'/} this did not improve the efficiency; so we started to solve this problem to replace the original more rigid {dede:field name='note'/} tag;

Example:

I want to display articles with different nodes in two columns. Currently, it cannot be achieved using "note". It can only be divided into columns for the same node, which inevitably seems a bit awkward. Not flexible enough.

Below I will write down my solution for students’ reference. First of all, I have to make it clear that it can only achieve the function, but the algorithm is not necessarily the best, because I am not very familiar with DEDECMS code and do not have I have studied it carefully and hope everyone will understand!

Step 1:

File location: {include/inc_archives_view.php}

The code is as follows:

//广告标记
//-----------------------
else if($ctag->GetName()=="myad"){
$this->dtp->Assign($tagid,$this->PartView->GetMyAd($typeid,$ctag->GetAtt("name")));
}
// 专题标识
// by phpfans
else if($ctag->GetName()=="specnote"){
$this->dtp->Assign($tagid,$this->ChannelUnit->GetSpecList('',$this->ChannelUnit->specrule,$ctag->GetAtt("id")));
}
Copy after login

Introduction:{Add a topic under the advertising tag Mark} so that the special article list page can recognize the specnote tag

Step 2:

File location: {include/inc_channel_unit.php}

var $specrule;
//-------------
//php5构造函数
//-------------
Copy after login

Introduction: Added Definition of $pecrule variable

Step 3:

File location:{include/inc_channel_unit.php}

The code is as follows:

else if($ftype=="specialtopic"){
$this->specrule = $fvalue;
$fvalue = $this->GetSpecList($fname,$fvalue); 
}
Copy after login

Introduction: Add here Add the sentence $this->specrule = $fvalue; in order to obtain the note field data of the addonspec table;

Step 4:

File location: {include/inc_channel_unit.php}

The code is as follows:

//获得专题文章的列表
//--------------------------------
function GetSpecList($fname,$noteinfo,$noteid="")
{
if(!isset($GLOBALS['__SpGetArcList'])) require_once(dirname(__FILE__)."/inc/inc_fun_SpGetArcList.php");
if($noteinfo=="") return "";
$rvalue = "";
$tempStr = GetSysTemplets("channel/channel_spec_note.htm");
$dtp = new DedeTagParse(); </p> <p></p> <p>$dtp->LoadSource($noteinfo);
if(is_array($dtp->CTags))
{
foreach($dtp->CTags as $k=>$ctag){
$notename = $ctag->GetAtt("name");
if($noteid!="" && $ctag->GetAtt("noteid")!=$noteid){ continue; } //指定名称的专题节点
if($noteid!="" && $ctag->GetAtt("noteid")===$noteid) {
$isauto = $ctag->GetAtt("isauto");
$idlist = trim($ctag->GetAtt("idlist"));
$rownum = trim($ctag->GetAtt("rownum"));
if(empty($rownum)) $rownum = 40;
$keywords = "";
$stypeid = 0;</p> <p>if($isauto==1){
$idlist = "";
$keywords = trim($ctag->GetAtt("keywords"));
$stypeid = $ctag->GetAtt("typeid");
}</p> <p>if(trim($ctag->GetInnerText())!="") $listTemplet = $ctag->GetInnerText();
else $listTemplet = GetSysTemplets("spec_arclist.htm");
$idvalue = SpGetArcList($this->dsql,
$stypeid,$rownum,$ctag->GetAtt("col"),
$ctag->GetAtt("titlelen"),$ctag->GetAtt("infolen"),
$ctag->GetAtt("imgwidth"),$ctag->GetAtt("imgheight"),
"all","default",$keywords,$listTemplet,100,0,$idlist);</p> <p>$notestr = str_replace("~notename~",$notename,$tempStr);
$notestr = str_replace("~spec_arclist~",$idvalue,$notestr);
$rvalue .= $notestr;
if($noteid!="" && $ctag->GetAtt("noteid")==$noteid){ break; }
}
}
}
$dtp->Clear();
return $rvalue;
}
Copy after login

Introduction: There are some small changes, you will see them clearly by comparing them yourself, so I won’t shiver anymore

Step 5:

Instructions: The original {dede:field name='note'/} tag is invalid. If you want to use it, please modify the fourth part by yourself. .

Very simple;

Done!

The above is the detailed content of How to use dedecms special template. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1670
14
PHP Tutorial
1274
29
C# Tutorial
1256
24
Where is the imperial cms resource network template? Where is the imperial cms resource network template? Apr 17, 2024 am 10:00 AM

Empire CMS template download location: Official template download: https://www.phome.net/template/ Third-party template website: https://www.dedecms.com/diy/https://www.0978.com.cn /https://www.jiaocheng.com/Installation method: Download template Unzip template Upload template Select template

How to upload local videos to dedecms How to upload local videos to dedecms Apr 16, 2024 pm 12:39 PM

How to upload local videos using Dedecms? Prepare the video file in a format that is supported by Dedecms. Log in to the Dedecms management backend and create a new video category. Upload video files on the video management page, fill in the relevant information and select the video category. To embed a video while editing an article, enter the file name of the uploaded video and adjust its dimensions.

How dedecms implements template replacement How dedecms implements template replacement Apr 16, 2024 pm 12:12 PM

Template replacement can be implemented in Dedecms through the following steps: modify the global.cfg file and set the required language pack. Modify the taglib.inc.php hook file and add support for language suffix template files. Create a new template file with a language suffix and modify the required content. Clear Dedecms cache.

What website can dedecms do? What website can dedecms do? Apr 16, 2024 pm 12:24 PM

Dedecms is an open source CMS that can be used to create various types of websites, including: news websites, blogs, e-commerce websites, forums and community websites, educational websites, portals, other types of websites (such as corporate websites, personal websites, photo album websites, video sharing website)

What loopholes does dedecms have? What loopholes does dedecms have? Aug 03, 2023 pm 03:56 PM

DedeCMS is an open source content management system that has some potential vulnerabilities and security risks: 1. SQL injection vulnerability. Attackers can perform unauthorized operations or obtain sensitive data by constructing malicious SQL query statements; 2. File Upload vulnerability, attackers can upload files containing malicious code to the server to execute arbitrary code or obtain server permissions; 3. Sensitive information leakage; 4. Unauthenticated vulnerability exploitation.

How to use dedecms How to use dedecms Apr 16, 2024 pm 12:15 PM

Dedecms is an open source Chinese CMS system that provides content management, template system and security protection. The specific usage includes the following steps: 1. Install Dedecms. 2. Configure the database. 3. Log in to the management interface. 4. Create content. 5. Set up the template. 6. Manage users. 7. Maintain the system.

How to change pictures in dedecms How to change pictures in dedecms Apr 16, 2024 pm 12:27 PM

Steps to modify images in DedeCMS: Log in to the DedeCMS backend. Visit the System > Media Management page. Select the image you want to edit. Click the "Edit" button. Modify image titles, descriptions, tags, and copyright information. Crop or resize picture. Click the "Save" button to save changes. Return to the media management page and click the "Update Image Library" button to apply the changes to the site.

How does dedecms implement template replacement? How does dedecms implement template replacement? Apr 16, 2024 pm 12:21 PM

To implement template replacement in DedecMS, you need to perform the following steps: Determine the template file to be replaced. Common files include index.htm, list.htm and show.htm. Create a new template file, retaining the DedecMS markup. Upload the new template file, overwriting the original file. clear cache. Refresh the site to see the changes.

See all articles