Home > CMS Tutorial > DEDECMS > body text

How to implement dede to call related articles under specified columns

藏色散人
Release: 2020-01-13 09:51:24
Original
3152 people have browsed it

How to implement dede to call related articles under specified columns

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=&#39;htmlspecialchars(@me)&#39;/] ” href=”[field:arcurl /]“>[field:title /]</a></li>
{/dede:likeart}
Copy after login

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=&#39;栏目ID&#39; row=&#39;10&#39; titlelen=&#39;20&#39;}
[field:textlink/]
{/dede:arclist}
Copy after login

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=&#39;4&#39; row=&#39;10&#39; titlelen=&#39;20&#39; keyword=&#39;&#39;}
[field:textlink/]
{/dede:arclist}
Copy after login

Code 1

How to implement dede to call related articles under specified columns

Effect 1:

How to implement dede to call related articles under specified columns

Code 2:

How to implement dede to call related articles under specified columns

Effect 2:

How to implement dede to call related articles under specified columns

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=&#39;{dede:field name=&#39;title&#39;/}&#39;
Copy after login

, 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”)’/}
Copy after login

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,”高三语文”)’/}
Copy after login

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}
Copy after login

will be changed to:

相关文章
{dede:field name=’keywords’ function=’ShowKeyWordArc(0,32,10,0,”@me”)’/}
Copy after login

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=&#39;&#39; row=&#39;&#39; col=&#39;&#39; titlelen=&#39;&#39; infolen=&#39;&#39;
imgwidth=&#39;&#39; imgheight=&#39;&#39; listtype=&#39;&#39; orderby=&#39;&#39; keyword=&#39;&#39;}
Copy after login

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
Copy after login

其中:

textlink = <a href=&#39;arcurl&#39;>title</a>
typelink = <a href=&#39;typeurl&#39;>typename</a>
imglink = <a href=&#39;arcurl&#39;><img  src=&#39;picname&#39; border=&#39;0&#39;    style="max-width:90%"How to implement dede to call related articles under specified columns" ></a>
image = <img  src=&#39;picname&#39; border=&#39;0&#39;    style="max-width:90%"How to implement dede to call related articles under specified columns" >
Copy after login

字段调用方法:[field:varname/]

如:

{dede:arclist infolen=&#39;100&#39;}
[field:textlink/]
<br>
[field:info/]
<br>
{/dede:arclist}
Copy after login

注:底层模板里的Field实现也是织梦标记的一种形式,因此支持使用PHP语法,Function扩展等功能

如: 给当天发布的内容加上 (new) 标志

[field:senddate runphp=&#39;yes&#39;]
$ntime = time();
$oneday = 3600 * 24;
if(($ntime - @me)<$oneday) @me = "<font color=&#39;red&#39;>(new)</font>";
else @me = "";
[/field:senddate]
Copy after login

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!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template