Discuz Add a Custom Data Call module


First add data calls
Second, source/language/block/directory new module module template
         Source / language / lang_blockclass.php Creates a module in module management
 
 Third, background update DIY module classification cache
 
 Fourth, add the appropriate module template
 
 The specific operation looks like this:
 First add data calls
1> New folders in the source/class/block/directory, for example: RankList
2>
 Under the Randlist folder, create a new one BlockClass.php , as follows:


<?php
      if(!defined('IN_DISCUZ')) {
            exit('Access Denied');
      }
$blockclass = array('name' => lang('blockclass', 'blockclass_ranklist'));
?>
Create a new one under the Randlist folder Block_rankListMember.php , as follows:


<?php
      if(!defined('IN_DISCUZ')) {
            exit('Access Denied');
      }

class block_ranklistmember extends discuz_block {

public $setting = array();


public function block_ranklistmember() {
$ this-> Setting = array (.........); // This is initialized for configuration
        }
 
        public function name() {
                                 // Install the data source here
                return lang('blockclass', 'blockclass_ranklist_script_ranklist');
        }

public function blockclass() {
// This type of call of the call module
                return array('ranklist', lang('blockclass', 'blockclass_ranklist'));
         }

public function fields() {
// This is set to fields. In addition to the variables supported by Discuz itself, only the fields of this can be named in the template.
                 $fields = array(.........); 
                 return $fields;
          }
 
        public function getsetting() {
                return $this->setting;
        }
 
 
        public function getdata($style, $parameter) {
                                 $ list = array (.......); // This is based on the actual situation or relevant data
                return array('html' => '', 'data' => $list);
        }
}
 
 
?>
 Lang (....) in the above code, it's language processing, it's a bit. There are also $reparts, $fields, $Lists formats can refer to the format of the corresponding variable in the source/class/block/element/ Block_Member.php .


Secondly, new files under the source /language / block / directory
<?php
      if(!defined('IN_DISCUZ')) {
            exit('Access Denied');
      }
$lang = array(
'RANKLIST_FIDS' => 'Edition Block',
'Ranklist_Orderbyby' => 'Sorting Mode', 
                         'Ranklist_Orderby_thread_num' => 'changes in topic',
'ranklist_dateline' => 'Sort time section',
'Ranklist_detetine_nolimit' => 'None',
'ranklist_dtteline_last_week' => 'Last week,
'RANKLIST_DTTELEL_LAST_MONH' => 'Last month',
'RANKLIST_STARTROW' => 'Started number data lines,
'ranklist_items' => 'displays the number of data bands, 
                         'ranklist_items_comment' => 'Sets the number of topic entries displayed once, set to integers greater than 0',
);
?>


source/language/lang_blockclass.php
<?php
......
'blockclass_ranklist' => "lists",
'blockclass_ranklist_forum_member' => "Troubleshooting user,
                 «BOCKCLASS_RANKLIST_SCRIPT_FORUM_MEMBER '=>« Advanceded »,
                 'blockclass_ranklist_field_author' => 'User name',
                 'blockclass_ranklist_field_authorid' => 'id id id',
                 'blockclass_ranklist_field_avatar' => 'user avatar',
'blockclass_ranklist_field_avatar_middle' => 'user avatar (middle)',
                 'blockclass_ranklist_field_avatar_big' => 'user avatar (large)',
                 'blockclass_member_field_authorbio' => 'User self-standing',
'blockclass_ranklist_field_thread_num' => 'subject',
        ....
?>
Third, enter the background cache of the update tool, should check the "DIY Module Classification Class" and start updating.
 
 
 Fourth, enter the template of the background-portal-module, add the appropriate template.

Go back
16-11-2022, 12:42