EQdkp Plus Navigation:   Home  |   Forum  |   Wiki  |   Translate  |   Bugtracker  |   WebSVN  |  USVN

Comments

From EQdkp Plus Wiki

Information
min. EQDKP-PLUS Version 0.6.2.4




Contents

How to use comments on your page

What is the comment system

The comment system eanbles the registered Users to write comments to the page who is enabled to use comments. The Raidplan plugin p.e. uses the comment system in the raidview to let the users comment every single raid. The news on the main page is using the comment system, tool

Implement the comment system

Setup the Settings

First of all, you have to setup the settings for your comment page:

$pcomments->SetVars(array(
  'attach_id'=>$member_id,
  'page'=>'member'
));
Setting Value Desciption
attach_id The attach ID is the id of the page to be shown. in this example it is the member id, for usage in the viewmember.php?memberid=1
page The page must be unique. p.e. member in our case. In your case, use PLUGINNAME_member to identify that these comments are used by your plugin and to avoid conflicts
language The language prefix. Is an optional field. Maybe you want to have your own translations for your plugin, than you can set the language prefix. In the example of the raidplan, the prefix is 'rp_'. See language table above for language strings.
auth Admin permissions for deleting comments. Should be used for plugins, p.e. 'a_raidplan_'

Init the Comments

After that, you have to pass the comments to the template system:

$tpl->assign_vars(array(
  'COMMENTS' => $pcomments->Show(),
));

Check if the comments are enabled

If you want to use the global possibility to disable the comments, simply change the code to:

$tpl->assign_vars(array(
  'COMMENTS' => ($core->config['pk_enable_comments'] == 1) ? $pcomments->Show() : '',
));

Language bits (optional)

// Comment System
  'rp_no_comments'                  => 'No comments avaialable',
  'rp_comments_raid'                => 'Comments to this raid',
  'rp_write_comment'                => 'write comment',
  'rp_send_comment'                 => 'save comment',
  'rp_save_wait'                    => 'Please wait, comment is beeing saved.',

Finished

Thats all. you see, its pretty simple using comments in your plugins.