Home> CMS Tutorial> DEDECMS> body text

How to call DEDE popular keywords

藏色散人
Release: 2019-12-25 10:27:10
Original
2115 people have browsed it

How to call DEDE popular keywords

How to call DEDE popular keywords?

Popular tags in DEDE, DEDE homepage digg, DEDE random popular keyword calling methods, friends in need can refer to the following

Recommended learning:梦Weavercms

DIGG

orderby=digg is sorted according to the number of DIGG

{dede:arclist row=5 titlelen=24 orderby=digg} [field:textlink/] [field:digg/]
{/dede:arclist}
Copy after login

The specific detailed code is as follows

正在载入,请稍后...
{dede:arclist row=5 titlelen=24 orderby=digg}
[field:textlink/][field:pubdate function=strftime('%m-%d',@me)/]
[field:info/]...
{/dede:arclist}
{dede:arclist row=5 titlelen=24 orderby=digg att=5}
[field:textlink/][field:pubdate function=strftime('%m-%d',@me)/]
[field:info/]...
{/dede:arclist}
{dede:arclist row=5 titlelen=24 orderby=click}
[field:textlink/][field:pubdate function=strftime('%m-%d',@me)/]
[field:info/]...
{/dede:arclist}
Copy after login

DEDE5 With the DIGG function, you can see that the number of "likes" has been increased by 1 after you like it, but if you refresh the page, you will find that the number of "likes" has been restored.

This is because the article has been liked and static HTML has been generated and fixed for display, unless the article is updated in the background next time.

Then I made the following modifications, that is, when the current article When it is liked, the article is updated at the same time so that the number of "likes" in its static HTML is the latest real number.

The modification method is very simple, as follows:

Open the digg.php file in the root directory of DEDE and insert the following three lines of code in line 26

include_once(dirname(__FILE__)."/include/inc_archives_view.php"); $arc = new Archives($aid); $reurl = $arc->MakeHtml();
Copy after login

The home page can be topped How to automatically refresh at once:

Open the diggindex.php file. .

Find

header("Expires:0"); header("Content-Type: text/html; charset=gb2312");
Copy after login

Add

below and the code is as follows:

if($action == indexdigg ){ echo ''.$row['digg'].''; echo ""; exit(); }
Copy after login

Home page template add

The code is as follows:

  
Copy after login

Example:

DIGG排行
{dede:arclist row=9 titlelen=24 infolen='29' orderby=digg}

[field:textlink/]

[field:info/]...
{/dede:arclist}
Copy after login

Template code:

{dede:tag row='10' sort='month' } [field:tagname/] {/dede:tag} 
Copy after login

CSS code:

.tag1 { color:#339900;font-weight:bold;} .tag2 { color:#e65730;} .tag3 { color:#00b9da;} .tag4 { color:#FE3981;font-weight:bold;font-size:14px;}
Copy after login
Copy after login

How to change tags:

The popular tags of the month are called by default. If You can think of something else:

Latest tag{dede:tag row='30' sort='new'}[field:highlight/] ([field:result/]){/dede:tag}

Popular tags of the month{dede:tag row='30' sort='month'}[field:tagname/]([field:result/]){/dede:tag}

Random tag{dede:tag row='60' sort='rand'}[field:highlight/]([field:result/]){/dede:tag}

The code of the web page part is as follows:

热门标签

    {dede:loop table='dede_search_keywords' sort='keyword' row='40' if=''}
  • [field:keyword/] {/dede:loop}
Copy after login

The code of the CSS part is as follows:

.tag1 { color:#339900;font-weight:bold;} .tag2 { color:#e65730;} .tag3 { color:#00b9da;} .tag4 { color:#FE3981;font-weight:bold;font-size:14px;}
Copy after login
Copy after login

Instructions for use: ◆There are 4 color changes in this color keyword code, if you want to add more To change the color, you only need to modify var num=4; and add .tag to the css part. For example: var num=5; add .tag5{ color:#00b9da;} to the css. Of course, you can also modify the corresponding css to change the font color. , size, font...etc., feel free to play with it!

The above is the detailed content of How to call DEDE popular keywords. 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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!