In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the method of modifying the title of the dedecms list page, which is very detailed and has a certain reference value. Interested friends must finish reading it!
How to modify the title of the dedecms list page?
Recommended study: dream weaving cms
Recently, when I saw the page title title of these major sina.com.cn qq.com 163.com stations, I found that their titles are as follows
Channel page: Channel name _ website name
List page: list name _ channel name _ website name
Content page: article name _ column 2 (list name) _ column 1 (channel name) _ website name
Also want to change their own small station to this, to check the dedecms help documents, found that there is no such relevant marks, it seems that you can only do it yourself, and start baidu, found that there are many such articles, please refer to another article transferred from this site
DEDE implements "article title-column name-website name"
But as a technician, I also wrote one myself. Here is the method I have implemented and how to call it and post it for everyone's convenience.
Version 5.0, the classes and templates involved are as follows
Inc_archives_view.php (latest version 5.5 is arc.archives.class.php) content page generation class inc_arclist_view.php (latest version 5.5 is arc.listview.class.php) list page generation class inc_typelink.php (latest version 5.5 is typelink.class.php) is used to obtain page location and column name related classes index_article.htm channel page template list_article.htm list page template article_article.htm content page template
First of all, let's modify the kernel of dedecms. (the file names I mentioned below are all in version 5.0. you can check the corresponding files of the new version one by one according to the files I listed above.)
Look for "function GetPositionLink" in Ctrl+F in the inc_typelink.php class and enter the following function under the GetPositionLink () function
This function is used to get the location information of the current page
For example, column 1 _ column 2
The following is the referenced content:
The code is as follows:
/ * * get the position of the current page, which is mainly used in the page title, where * $typeid column id * & $info references the separator between the columns * $SplitSymbol * sort desc: column 2 _ column 1, asc: column 1 _ column 2 * / function getPosition ($typeid,&$info,$SplitSymbol='_',$orderby='desc') {if (empty ($typeid)) return false $this- > dsql- > SetQuery ("Select ID,reID,typename From jyk_arctype where ID='". $typeid. "'"); $infos = $this- > dsql- > GetOne (); $symbol = empty ($info)? "": $SplitSymbol; if ($orderby=='desc') {$info = $info.$symbol.$infos ['typename'];} else {$info = $infos [' typename']. $symbol.$info;} if ($infos ['reID']! =' 0') {$this- > getPosition ($infos ['reID'], & $info,$SplitSymbol,$orderby);}}
As shown in the figure:
Next, add the relevant code to the class of the parsing list page and the content page.
Look for $this- > Fields ['position'] in the inc_archives_view.php class and add the following code at the bottom of this line
The code is as follows:
$this- > TypeLink- > getPosition ($this- > Fields ['typeid'], & $this- > Fields [' position2'], "_")
Also look for $this- > Fields ['position'] in the inc_arclist_view.php class and add the following code under him
The code is as follows:
$this- > TypeLink- > getPosition ($typeid,&$this- > Fields ['position2'], "_")
All right, now let's call the
Call with {dede:field name='position2'/} in the title tag of list_article.htm and article_article.htm
As shown in the picture
Note: the channel page does not need to be called in this way, although you can get the channel name, but it is more convenient to use {dede:field name='typename'/}, and there is no need to modify the inc_arcpart_view.php class.
The results are as follows:
O, plus this article, there are four different ways to modify the dream weaving system to realize "article name _ column 1 _ column 2 _ website name". Choose it according to your personal situation.
I wish your website more collected by baidu,google, hehe.
Later:
When developing this function, it is found that dede is not cached like column data tables (usually not changed), and the program is linked to the database in real time when in use, such as inc_typelink.php is directly checked by sql. I can not help but sigh that the processing of phpcms is better than that of dedecms. Phpcms caches data that does not change very often into php files directly, although the generation speed of the latest version of dedecms 5.5 is OK. But dream developers would be faster if they could better optimize these details.
The above is all the contents of the method of changing the title of the dedecms list page, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.