In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how dedecms calls the body content field on the list page. I hope you will gain a lot after reading this article. Let's discuss it together.
How does dedecms invoke body content fields on the list page?
We all know that the optimization of description is also closely related to seo, and novices to seo often do not have this experience. It may be better not to write description, but there is a problem if you do not write description, that is, you cannot call up a brief introduction to the article on the article list page.
Such as the following code:
{dede:list pagesize='10'} [field:title/] [field:description/]... Author: [field:writer/] posted on: [field:pubdate function= "GetDateTimeMK (@ me)" /] comment: [field:scores/] Click: [field:click/] {/ dede:list}
Because the introduction of the article will be blank when you don't write description, which seriously affects the beauty and function of the page.
Here are some of my solutions.
We can intercept the first 100 words of the article as a brief introduction to the article, here we want to use a combination of two functions, cn_substr and html2text, to intercept the article after escaping. The test code: [field:body function= "cn_substr (html2text (@ me), 200)" /], it turns out it still doesn't work because body and description are not in the same table. So we have to start with the procedure.
Open extend.func.php under the include file and add the following code:
/ / get a single document bodyfunction GetOneArchiveBody ($aid,$length) {global $dsql;$aid = trim (ereg_replace ('[^ 0-9]','', $aid)); $body =''; $query = "Select art.body From `dede_ addonSecretle`art, `dede_ archives` arc where art.aid='$aid' and art.aid=arc.id"; $arcRow = $dsql- > GetOne ($query); if (! is_array ($arcRow)) {return $body } if (isset ($arcRow ['body'])) {$body = cn_substr (html2text ($arcRow [' body']), $length);} return $body;}
Call the template in the foreground:
{dede:list pagesize='10'} [field:title/] [field:id function= "GetOneArchiveBody (@ me,200)" /]. Author: [field:writer/] posted on: [field:pubdate function= "GetDateTimeMK (@ me)" /] comment: [field:scores/] Click: [field:click/] {/ dede:list} finished reading this article, I believe you have some understanding of dedecms's method of calling the body content field in the list page, want to know more about it, welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.