KillerSneak |
|
---|---|
I'm still using the one made for seditio, only thing is that if someone posts a comment and i get the update e-mail not entitlement is given for the e-mail
http://www.t3-design.com/latest-comments-in-sed/comment-page-1/ <- I'm not using this one as i have customized mine a bit so i don't think it's original anymore. I want to know if anybody is willing to help me port it to Cotonti - I for one find it very usefull to have the recent comments on the frontpage (also as follow-up and to see what interests the community the most). I think the recent items code/setup can be used to do this? Added 14 minutes later: <?PHP
/* ====================
Seditio - Website engine
Copyright Neocrome
http://www.neocrome.net
[BEGIN_SED]
File=plugins/recentcomments/recentcomments.php
Version=110
Updated=2009-mar-14
Type=Plugin
Author=Neocrome
Description=
[END_SED]
[BEGIN_SED_EXTPLUGIN]
Code=recentcomments
Part=main
File=recentcomments
Hooks=index.tags
Tags=index.tpl:{PLUGIN_LATESTCOMMENTS}
Minlevel=0
Order=10
[END_SED_EXTPLUGIN]
==================== */
if (!defined('SED_CODE')) { die('Wrong URL.'); }
/* ============ MASKS FOR THE HTML OUTPUTS =========== */
$cfg['plu_mask_comments'] = " %3\$s"." %1\$s"." ".$cfg['separator']." "."%2\$s"."<br />";
// %1\$s = Link to the comment
// %2\$s = Author
// %3\$s = Date
$plu_empty = $L['None']."<br />";
/* ================== FUNCTIONS ================== */
function sed_get_latestcomments($limit, $mask)
{
//global $L, $db_com, $usr, $cfg, $plu_empty;
global $L, $db_com, $db_pages, $usr, $cfg, $sed_cat, $plu_empty;//motor2hg
$sql = sed_sql_query("SELECT MAX(com_id) AS _id, MAX(com_date) AS _date FROM $db_com WHERE com_isspecial=0 GROUP BY com_code ORDER BY _date DESC LIMIT $limit");
$com_latest = array();
while($row = sed_sql_fetcharray($sql)) $com_latest[] = $row['_id'];
$sql = sed_sql_query("SELECT com_id, com_code, com_date, com_author FROM $db_com WHERE com_id IN('".implode("','",$com_latest)."') ORDER BY com_date DESC");
while ($row = sed_sql_fetcharray($sql))
{
/*$com_code = $row['com_code'];
$j = substr($com_code, 0, 1);
$k = substr($com_code, 1);*/
$com_code = $row['com_code'];//motor2hg
$z = $row['page_title'];//motor2hg
$j = substr($com_code, 0, 1);//motor2hg
$k = substr($com_code, 1);//motor2hg
switch($j)
{
//case 'p':
//$lnk = "<a href=\"page.php?id=$k&comments=1#c".$row['com_id']."\">".$L['Page']." #".$k."</a>";
//break;
//////////////////////////////motor2hg/////////////////////////////
case 'p':
$sql2 = sed_sql_query("SELECT page_title FROM sed_pages WHERE page_id = $k LIMIT 0, 30");
while ($row2 = sed_sql_fetcharray($sql2))
{ $page_title = $row2['page_title']; }
$lnk = "<a href=\"page.php?id=$k&comments=1#c".$row['com_id']."\">"." \"".$page_title."\"</a>";
break;
///////////////////////motor2hg/////////////////////////////////////
case 'v':
$lnk = "<a href=\"javascript:polls('".$k."&comments=1#c".$row['com_id']."')\">".$L['Poll']." #".$k."</a>";
break;
}
$res .= sprintf($mask, $lnk, sed_cc($row['com_author']), date($cfg['formatyearmonthday'], $row['com_date'] + $usr['timezone'] * 3600));
}
$res = (empty($res)) ? $plu_empty : $res;
return($res);
}
/* ============= */
if (!$latestcomments && $cfg['plugin']['recentcomments']['maxcomments']>0)
{
$latestcomments = sed_get_latestcomments($cfg['plugin']['recentcomments']['maxcomments'], $cfg['plu_mask_comments'] );
//sed_cache_store('latestcomments', $latestcomments, 5);
}
$t-> assign(array(
"PLUGIN_LATESTCOMMENTS" => $latestcomments,
));
?>
Added current plugin code.[/] Added 27 seconds later: Does anybody else see the lose closing tag above? [/] ?? shouldn't be there? |
|
Dit bericht is bewerkt door KillerSneak (2009-07-22 02:12, 15 jaren ago) |
Trustmaster |
|
---|---|
I think there is recentcomments plugin in the repository which has been ported. You can download it here.
May the Source be with you!
|
KillerSneak |
|
---|---|
Does this mean that it works? Or that I'm going to test it (not that i mind, but for me to prepare / backup before I'm going to test it :) )
Added 3 minutes later: error Fatal error: Uncaught exception 'Exception' with message 'Block RECENTCOMMENTS is not closed correctly in ./plugins/recentcomments/tpl/recentcomments.tpl' in /home/donotarg/public_html/system/xtemplate.php:171 Stack trace: #0 /home/donotarg/public_html/system/xtemplate.php(39): XTemplate->restart('./plugins/recen...') #1 /home/donotarg/public_html/plugins/recentcomments/recentcomments.index.php(32): XTemplate->__construct('./plugins/recen...') #2 /home/donotarg/public_html/system/core/index/index.inc.php(44): include_once('/home/donotarg/...') #3 /home/donotarg/public_html/index.php(20): require_once('/home/donotarg/...') #4 {main} thrown in /home/donotarg/public_html/system/xtemplate.php on line 171 Added 21 minutes later: fixed: <!-- END: RECENTCOMMENTS--> should be <!-- END: RECENTCOMMENTS --> Added 6 minutes later: Okey tried it. It's nice to have the ajax effect just some notes: No poster name of the comment? (see code above of old version) Want to be able to chnage the date format. |
|
Dit bericht is bewerkt door KillerSneak (2009-07-22 03:07, 15 jaren ago) |
SunChase |
|
---|---|
it would be great if someone made a Recent comments by user plugin...
[url=http://ka13.orgfree.com]KA13[/url] - The essence of creativity
|
pieter |
|
---|---|
Does this exists for Siena? I can't port it, I'm to stupid (for php) :-) Added 10 minutes later: In the comments plugin, you can add the tag {PAGE_ROW_COMMENTS} into recentitems.tpl, but this is not for the index-page. ... can we help you ...
|
|
Dit bericht is bewerkt door pieter (2012-09-22 05:54, 12 jaren ago) |
Kort |
|
---|---|
Pieter: we'll announce the Recent Comments plugin along with a bunch of others soon. No need for porting. SED.by - создание сайтов, разработка плагинов и тем для Котонти
|
pieter |
|
---|---|
Perfect. What is soon? ... can we help you ...
|
Trustmaster |
|
---|---|
There's a port I made 10 months ago actually. May the Source be with you!
|
pieter |
|
||
---|---|---|---|
Thanks, The date is not showing.
Is this still correct after the changes in Siena? ... can we help you ...
|
Trustmaster |
|
||
---|---|---|---|
It needs an update:
May the Source be with you!
|
Uch |
|
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Предлагаю сделать небольшие изменения, что бы получить еще и кол-во комментариев:
2.Сразу после данной строки с SQL запросом добавим опеределине массива, содержащего кол-во комментариев к каждому объекту:
3. Внесем в цикл
строку
и получим:
4. Добавим в определение тегов после 102 строки новый тег:
Готово. |
Twiebie |
|
---|---|
Please use English in the normal sections of the forums. |