Dede shows on the article page that the author only displays the user name, but if I want to transform dede into a more social website, I think it is necessary to show the author's profile picture, however, the official website does not have the corresponding template tag.
On the Internet, we can see that the solution to this problem is basically to directly call the runphp program segment on the template page. Indeed, this method is feasible.
But I am not inclined to do this, because many times we need differentiated functions, and every time such a mix of php code looks messy.
I modified it directly in the PHP file so that the Article template can call several new labels.
Find the/include/arc. archives. class. php file.
Search for "$ this-> addTableRow = $ this-> dsql-> GetOne ($ query);" and jump to about 154 rows, add the following code under else {$ this-> Fields ['templet'] = $ this-> Fields ['redirecturl'] =:
/* HEJIE_MODIFY author information @ www.68cpu.com */$ query = "SELECT * FROM jcode_member WHERE 'mid '= ". $ this-> Fields ['mid ']; $ authorInfo = $ this-> dsql-> GetOne ($ query ); $ this-> Fields ['authorance'] = $ 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'] = "<a href = '". $ GLOBALS ['cfg _ basehost']. "/member/index. php? Uid = ". $ authorInfo ['userid']. "'> Fields ['authorface']. "'/> </a>"; $ this-> Fields ['authoremail'] = $ authorInfo ['email '];
The purpose of this Code is to query the author information based on the Author id, including the Avatar.
I found three types of profile email and user name for future use.
I have done some processing in the label of the user avatar, so that the link can be directly generated when called in the template, pointing to the author's space.
The statement for calling the author's profile picture in the article template is:
{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 '], the corresponding template tag is {dede: field. authoremail /}