If you have any questions about Discuz, come in.

Source: Internet
Author: User
If you have any questions about Discuz, come in. I used DZ in a rough way and did not use its functions carefully, but now I have studied its code. in some cases, you may not be able to see the meaning of the code.
if(!empty($_G['forum']['threadsorts']['types'])) {require_once libfile('function/threadsort');$showpic = intval($_G['gp_showpic']);$templatearray = $sortoptionarray = array();foreach($_G['forum']['threadsorts']['types'] as $stid => $sortname) {loadcache(array('threadsort_option_'.$stid, 'threadsort_template_'.$stid));sortthreadsortselectoption($stid);$templatearray[$stid] = $_G['cache']['threadsort_template_'.$stid]['subject'];$sortoptionarray[$stid] = $_G['cache']['threadsort_option_'.$stid];}if(!empty($_G['forum']['threadsorts']['defaultshow']) && empty($_G['gp_sortid']) && empty($_G['gp_sortall'])) {$_G['gp_sortid'] = $_G['forum']['threadsorts']['defaultshow'];$_G['gp_filter'] = 'sortid';$_SERVER['QUERY_STRING'] = $_SERVER['QUERY_STRING'] ? $_SERVER['QUERY_STRING'].'&sortid='.$_G['gp_sortid'] : 'sortid='.$_G['gp_sortid'];$filterurladd = '&filter=sort';}$_G['gp_sortid'] = $_G['gp_sortid'] ? $_G['gp_sortid'] : $_G['gp_searchsortid'];if(isset($_G['gp_sortid']) && $_G['forum']['threadsorts']['types'][$_G['gp_sortid']]) {$searchsortoption = $sortoptionarray[$_G['gp_sortid']];$quicksearchlist = quicksearch($searchsortoption);$_G['forum_optionlist'] = $_G['cache']['threadsort_option_'.$_G['gp_sortid']];$forum_optionlist = getsortedoptionlist();}}

In short, I wonder if I can explain this section in detail?


Reply to discussion (solution)

Debugging can clarify

Specifically, no one can read the code for you.

Sorry, I forgot to mention it. this is the DZ source code.
From:
Discuz! X2
/Source/module/forum/forum_forumdisplay.php
195th rows.
Thank you very much. if you understand it, please answer the question. all the other parts of this file have been understood. The role of this file is very simple, that is, the Post list.
But I don't know what this judgment means. please help me solve it. thank you.

I hope you can give your mouth a sigh of relief. if you don't give your voice better, don't give it a sigh of relief. for example: andyxl.
If you understand this, please answer. thank you.

By the way, let's explain to #1. Why didn't I debug it?... because you deleted this section, and there was no impact on the page...
I am not familiar with DZ functions. I don't know how to operate it, so I can see the difference...

Besides

if(!empty($_G['forum']['threadsorts']['types'])) {

Change
if(true)

Force it to execute this section, which is pushed, but it cannot be seen that the difference...

Var_dump ($ _ G)
The output parameter shows that this variable stores a lot of information, such as the user ID and name of Shenma.
Submit to the source/directory. Function or module

No use of discuz

I also set up this forum Discuz in the LAN! X2, added the online examination plug-in, which is not bad, but it is not empty to study the background code.

Confirmed today. this is from
Row 399th of/source/function/function_forum.php and the loadforum function. There are four serialized operations on the four fields in row 506th of the file, including this field.
Code:

foreach(array('threadtypes', 'threadsorts', 'creditspolicy', 'modrecommend') as $key) {$forum[$key] = !empty($forum[$key]) ? unserialize($forum[$key]) : array();if(!is_array($forum[$key])) {$forum[$key] = array();}}

According to common sense, this thing should be stored as an array.
In row 3 of the file, you can see what $ forum is:
$forum = DB::fetch_first("SELECT f.fid, f.*, ff.* $accessadd1 $modadd1, f.fid AS fidFROM ".DB::table('forum_forum')." fLEFT JOIN ".DB::table("forum_forumfield")." ff ON ff.fid=f.fid $accessadd2 $modadd2WHERE f.fid='$fid'");

Obviously, this field is a field in the forum_forum/forum_forumfield table. after confirmation, this field is
Forum_forumfield, according to my research in the previous two days, I know that this table is an extended table in the discuz section. so most of the problems have been solved, and
if(!empty($_G['forum']['threadsorts']['types']))

In the first line of code of the first post, it is clear that this field stores arrays after serialize, but what TM is, that is, it is not clear. I hope someone can understand it.

By the way, describe with the post
$ _ G ['forum ']...
To operate the $ forum obtained in the database, because
/Source/function/function_forum.php
In the end of the loadforum function (the first line of the file), write the following lines of code:

$_G['fid'] = $fid;$_G['tid'] = $tid;$_G['forum'] = &$forum;$_G['current_grouplevel'] = &$grouplevel;

Oh, it's a reference, not a direct value assignment.
Online and other familiar friends appear

I am only in touch with this stuff. It is not easy to learn and cannot provide specific guidance. Make progress together. If the landlord has good information, please share it.

If (! Empty ($ _ G ['forum'] ['threadsorts'] ['types']) {// whether the category information is empty require_once libfile ('function/threadsort '); $ showpic = intval ($ _ G ['GP _ showpic ']); // Picture? $ Templatearray = $ sortoptionarray = array (); foreach ($ _ G ['forum'] ['threadsorts'] ['types'] as $ stid => $ sortname) {loadcache (array ('threadsort _ option _'. $ stid, 'threadsort _ template _'. $ stid); sortthreadsortselectoption ($ stid); $ templatearray [$ stid] = $ _ G ['cache'] ['threadsort _ template _'. $ stid] ['subobject']; $ sortoptionarray [$ stid] = $ _ G ['cache'] ['threadsort _ option _'. $ stid]; // get all current category information} if (! Empty ($ _ G ['forum'] ['threadsorts'] ['defaultshow ']) & empty ($ _ G ['GP _ sortid']) & amp; empty ($ _ G ['GP _ sortall']) {$ _ G ['GP _ sortid'] = $ _ G ['forum'] ['threadsorts'] ['defaultshow ']; $ _ G ['GP _ filter'] = 'sortid'; $ _ SERVER ['query _ string'] = $ _ SERVER ['query _ string']? $ _ SERVER ['query _ string']. '& sortid = '. $ _ G ['GP _ sortid']: 'sortid = '. $ _ G ['GP _ sortid']; $ filterurladd = '& filter = sort ';} $ _ G ['GP _ sortid'] = $ _ G ['GP _ sortid']? $ _ G ['GP _ sortid']: $ _ G ['GP _ searchsortid']; if (isset ($ _ G ['GP _ sortid']) & $ _ G ['forum'] ['threadsorts'] ['types'] [$ _ G ['GP _ sortid']) {$ searchsortoption = $ sortoptionarray [$ _ G ['GP _ sortid']; $ quicksearchlist = quicksearch ($ searchsortoption ); $ _ G ['forum _ optionlist'] = $ _ G ['cache'] ['threadsort _ option _'. $ _ G ['GP _ sortid ']; $ forum_optionlist = getsortedoptionlist () ;}// the above code should be used to process classification information

Thank you for the winner. What is this category?
Can I call it from the background? Or where can I call it?
I want to call it and test this code so that I can understand the specific meaning.

Miserable.
As #12 (I have never understood the meaning of a safflower and a blue flower under it. after reading it for a long time, I thought it was a flower sale .) what is classification information? A miserable Dz makes a lot of flowers.
Simply put, I have been tossing code for a long time, and finally learned about it in the background...
It is the "vote", "help", and so on you selected when posting. we recommend that you go
Background-Forum-forum management
Click "edit" next to a topic"
Select Other-category information...
Pushed...

Add a post, and select the DZ database under the command line. use this SQL to try again...
Select threadsorts from pre_forum_forumfield
You can see

What is DZ learning now? At the beginning, I started to learn about DZ. I had nothing to worry about and had no data. I felt that I had no idea about the program for a long time. Do I have any good materials, websites, blogs, or anything?
Don't hesitate to enlighten me ~~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.