In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 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 displaying the author's profile picture on the page in the dede article, which has a certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
How does the dede article page display the profile picture of the author?
Dede shows that the author only shows his user name on the article page, but if I want to transform dede into a more social site, I think it is necessary to display the author's profile picture, but there is no official template label.
Recommended study: dream weaving cms
On the Internet, we can see that the solution to this problem is basically to call the program segment of runphp directly on the template page, which is indeed feasible.
But I'm not inclined to do this, because a lot of times we need differentiated functionality, and every time it looks messy with php code.
I modified it directly in the php file so that the article template can call several new tags.
Find / include/arc.archives.class.php file
Search for "$this- > addTableRow = $this- > dsql- > GetOne ($query);", jump to about 154lines, and add the following code to else {$this- > Fields ['templet'] = $this- > Fields [' redirecturl'] =';}:
The code is as follows:
/ * HEJIE_MODIFY article author information @ www.68cpu.com*/ $query = "SELECT * FROM jcode_member WHERE `mid` =". $this- > Fields ['mid']; $authorInfo = $this- > dsql- > GetOne ($query); $this- > Fields [' authoranme'] = $authorInfo ['uname']; $this- > Fields [' authorface'] = $authorInfo ['face'] If (empty ($this- > Fields ['authorface'])) {$this- > Fields [' authorface'] = ($this- > authorInfo ['sex'] = =' female'). / member/templets/images/dfgirl.png':'.. / member/templets/images/dfboy.png';} $this- > Fields ['authorface'] = "
"; $this- > Fields ['authoremail'] = $authorInfo [' email']
The purpose of this code is to query the author's information according to the id of the author of the article, including the avatar, of course.
Here I have three kinds of information: avatar email and user name for future backup query.
I have done some processing in the tag of the user's avatar so that when called in the template, a link can be generated directly to the author's space.
The statement to call the author's profile picture in the article template is:
The code is as follows:
{dede:field.authorface/}
The php code corresponding to this tag is actually the above $this- > Fields ['authorface']. Similarly, we need to query the author's email information in the php code $this- > Fields [' authoremail'], and the corresponding template tag is {dede:field.authoremail/}.
These are the details of how the dede article page displays the author's avatar, please pay attention to other related articles!
Thank you for reading this article carefully. I hope it is helpful for everyone to share the method of displaying the author's profile picture on the page in the dede article. At the same time, I also hope that you can support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.