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"))); }
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构造函数 //-------------
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); }
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; }
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











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 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.

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.

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)

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.

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.

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.

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.
