Total Users Online: 0 üye, 136 guest | Tarih/Saat: 2025-04-29 07:03
Adding ratings/comments to your own plugins
How to easily add these features to your plugin.
Adding ratings/comments to your own plugins
How to easily add these features to your plugin.

Seditio's core comments/ratings system is very easy to implement into your plugin. It takes a few lines of code and five steps as follows:

Step 1:

Pulls the switch (if the ratings/comments is on) from the url.

Kod:
$ratings = sed_import('ratings','G','BOL',1,TRUE);
$comments = sed_import('comments','G','BOL',1,TRUE);



Step 2:

This is how your ratings/comments will be identified in the database, pretty self explainatory.
Kod:
$item_code = 'name'.$id;


Example:
For Seditio's page system is uses..
Kod:
$item_code = 'p'.$id;


Note: The default length of this column in Seditio is varchar(16) in MySQL. Normally any ID in Seditio is a maximum of int(11). So it is best to use identifiers at a maximum length of 5. Also be sure to not overlap identifiers with any other plugin/core.


Step 3:

Identify the URL of where this rating appears, this is done so that when you click the comment/rating icon it expands so the user can vote if he/she hasn't done so already.

Example:
Kod:
$item_url = "plug.phpşe=plugin&...".$id;
]

Step 4:

Retrieve/combine the variables for the final result.
Kod:
list($comments_link, $comments_display, $comments_count) = sed_build_comments($item_code, $item_url, $comments);
list($ratings_link, $ratings_display) = sed_build_ratings($item_code, $item_url, $ratings);



Step 5:

Outputting the results can be done using any of the following ways..

Kod:
$t->assign(array(
"COMMENTS" => $comments_link,
"COMMENTS_DISPLAY" => $comments_display,
"COMMENTS_COUNT" => $comments_count,
"RATINGS" => $ratings_link,
"RATINGS_DISPLAY" => $ratings_display
));


Or by simply using {PHP.comments_link}, and so on, in your .tpl files.

Henüz yorum yapılmamıştır.
Adding ratings/comments to your own plugins
Author: Kaan
Date: 2009-12-28 10:28
Comments: (0)
Benzer SayfalarYorum
Comments counter0
Facebook Comments Plugin (Seditio)3
Yeni Oylama (Ratings) Sistemi0
Open Comments2
INLINE COMMENTS0
Kullanıcı Duvarı (users comments)0
Twitter Plugins0
Comments CAPTCHA0
Show Ratings on Pages0
Quick Quote Comments1
 
Powered by Seditio © 2009-2012 All Rights Reserved