How can dede call relevant articles under specified columns?
First of all, two requirements must be met:
Recommended learning: 梦Weavercms
1. To call the specified column
2. The called article must contain the specified keyword
Related document call
{dede:likeart titlelen=’24′ row=’10′} <li><a title=”[field:title function='htmlspecialchars(@me)'/] ” href=”[field:arcurl /]“>[field:title /]</a></li> {/dede:likeart}
Note: This is the official call template of dede, but the basis for the call is still unclear!
Specify the column call
{dede:arclist typeid='栏目ID' row='10' titlelen='20'} [field:textlink/] {/dede:arclist}
The following is the effect I want to achieve:
Specify the column (ID=4) related news (keyword needs to call the keyword or title) Call
{dede:arclist typeid='4' row='10' titlelen='20' keyword=''} [field:textlink/] {/dede:arclist}
Code 1
Effect 1:
Code 2:
Effect 2:
If you only use a single keyword here, then that’s fine. The key below is to call my keywords: keyword='{dede:field name='keywords'/}' Or I call the title
keyword='{dede:field name='title'/}'
, but this is rarely used because it calls the template . No one wants all articles to use the same keyword!
Blogger recommended method:
--------------------------------- -------------------------------------------------- ---
placed in the article template page
{dede:field name=’keywords’ function=’ShowKeyWordArc(0,32,10,0,”@me”)’/}
means that related articles in all columns (related to the keywords of the current article) are fetched. The maximum title length is 32, and the maximum number of titles displayed is 10. Articles, do not display thumbnails
or
{dede:field name=’keywords’ function=’ShowKeyWordArc(0,32,10,0,”高三语文”)’/}
You can find articles that contain "senior high school Chinese", or contain "senior high school" or "Chinese" in the title
For example, This paragraph:
相关文章 {dede:likeart titlelen=’24′ row=’10′} [field:textlink/]< > {/dede:likeart}
will be changed to:
相关文章 {dede:field name=’keywords’ function=’ShowKeyWordArc(0,32,10,0,”@me”)’/}
Related articles based on keywords are very good in terms of user experience and SEO
The only bad thing The problem is that it will be much slower when generating static
-------------------------------- -------------------------------------------------- -------------------
Attachment 1: How to call the keyword of the current document in arclist (dedecms Dreamweaver Technology Forum)
Attachment 2: Learning experience of {dede:arclist}, calling any field in an article or software
Attachment 3. dedecms realizes the effect of {dede:arclist keyword='[field:title/]'}
[Arclist tag] This tag is the most commonly used tag in DedeCms, also called a free list tag. Among them, hotart, coolart, likeart, artlist, imglist, imginfolist, specart, and autolist are all different attributes defined by this tag. Extended alias tag. Function description: Get the specified document list. Scope of application: cover template, list template, document template. Basic syntax:
{dede:arclist typeid='' row='' col='' titlelen='' infolen='' imgwidth='' imgheight='' listtype='' orderby='' keyword=''}
Underlying template (InnerText)
{/dede:arclist} Attribute description:
[1] typeid='' represents the column ID, which generally does not need to be specified in list templates and file templates. In the cover template, "," is allowed to represent multiple columns separately;
[ 2] row='' means the total number of document lists returned;
[3] col='' means how many columns to display (default is single column);
[4] titlelen='' means Title length;
[5] infolen='' indicates the content introduction length;
[6] imgwidth='' indicates the thumbnail width;
[7] imgheight= '' represents the thumbnail height;
[8] type='' represents the file type, where a null value, this attribute is not used, or type='all' is a normal document
§ type ='commend', indicates recommended documents, equivalent to {dede:coolart}{/dede:coolart}
§ type='image', indicates documents that must contain thumbnail images, equivalent to {dede :imglist}{/dede:imglist}, {dede:imginfolist}{/dede:imginfolist}
§ When type='spec', it indicates the topic, which is equivalent to the mark {dede:specart}{/dede: specart}
The above attribute values can be used in combination, such as: type='commend image' indicates the recommended image document
[9] orderby='' indicates the sorting method, the default value is senddate by Release time arrangement.
§ orderby='hot' or orderby='click' means sorting by the number of clicks
§ orderby='pubdate' means sorting by publication time (that is, the time value that the front desk allows to change)
§ orderby='sortrank' Sort by the new sort level of the article (use this attribute if you want to use pinned articles)
§ orderby='id' Sort by article ID
§ orderby='postnum' Sort by the number of article comments
§ orderby='rand' Randomly obtain a document list with specified conditions
[10] orderway='' 值为 desc 或 asc ,指定排序方式是降序还是顺向排序,默认为降序。
[11] keyword='' 表示含有指定关键字的文档列表,多个关键字用","分开
[12] channelid='' 表示特定的频道模型ID,内置的频道:专题(-1)、文章(1)、图集(2)、Flash(4)、软件(3)
[13] limit='起始,结束' 表示限定的记录范围,row属性必须等于"结束 - 起始",mysql的limit语句是由0起始的,如 “limit 0,5”表示的是取前五笔记录,“limit 5,5”表示由第五笔记录起,取下五笔记录,使用了本属性后,row属性将无效。
[14] att='数值' 表示自定义属性值
[15] subday='天数' 表示在多少天以内的文档,通常用于获取指定天数的热门文档、推荐文档、热门评论文档等
[16] partsort='排列位数' 表示自动获得父栏目的所有子数中排列在第几位的栏目ID,标记为 {dede:autolist}{/dede:autolist} 时,使用本属性才有效。
底层模板字段:
ID(同 id),title,iscommend,color,typeid,ismake,description(同 info),writer,shorttitle,memberid pubdate,senddate,arcrank,click,litpic(同 picname),typedir,typename, arcurl(同 filename),typeurl,stime(pubdate 的"0000-00-00"格式), textlink,typelink,imglink,image
其中:
textlink = <a href='arcurl'>title</a> typelink = <a href='typeurl'>typename</a> imglink = <a href='arcurl'><img src='picname' border='0' style="max-width:90%"How to implement dede to call related articles under specified columns" ></a> image = <img src='picname' border='0' style="max-width:90%"How to implement dede to call related articles under specified columns" >
字段调用方法:[field:varname/]
如:
{dede:arclist infolen='100'} [field:textlink/] <br> [field:info/] <br> {/dede:arclist}
注:底层模板里的Field实现也是织梦标记的一种形式,因此支持使用PHP语法,Function扩展等功能
如: 给当天发布的内容加上 (new) 标志
[field:senddate runphp='yes'] $ntime = time(); $oneday = 3600 * 24; if(($ntime - @me)<$oneday) @me = "<font color='red'>(new)</font>"; else @me = ""; [/field:senddate]
The above is the detailed content of How to implement dede to call related articles under specified columns. For more information, please follow other related articles on the PHP Chinese website!