cotonti.com : Recent comments https://www.cotonti.com Последние сообщения в теме Cotonti en Mon, 22 Dec 2025 08:56:13 -0000 Twiebie Please use English in the normal sections of the forums.

]]>
чт, 08 ноя 2012 12:55:02 -0000
Uch Предлагаю сделать небольшие изменения, что бы получить еще и кол-во комментариев:

1.В строке 45 заменим SQL запрос на:

$sqlcom = $db->query("SELECT MAX(com_id) AS _id, MAX(com_date) AS _date, COUNT(com_code) AS _count, com_code FROM $db_com GROUP BY com_code ORDER BY _date DESC LIMIT $comd, ".$cfg['plugin']['recentcomments']['commentsperpage']);

2.Сразу после данной строки с SQL запросом добавим опеределине массива, содержащего кол-во комментариев к каждому объекту:

$com_count = array();

3. Внесем в цикл

	while($row = $sqlcom->fetch())
	{
		$com_latest[] = $row['_id'];
	}

строку

$com_count[$row['com_code']] = $row['_count'];

и получим:

	while($row = $sqlcom->fetch())
	{
		$com_latest[] = $row['_id'];
		$com_count[$row['com_code']] = $row['_count'];
	}

4. Добавим в определение тегов после 102 строки новый тег:

"RECENTCOMMENTS_ROW_COUNT" => $com_count[$k]

Готово.

]]>
чт, 08 ноя 2012 12:48:10 -0000
Trustmaster It needs an update:

"RECENTCOMMENTS_ROW_DATE" => cot_date('datetime_short', $row['com_date']),

 

]]>
вс, 23 сен 2012 15:05:10 -0000
pieter Thanks,

The date is not showing. 

"RECENTCOMMENTS_ROW_DATE" => cot_date($cfg['datetime_short'], $row['com_date'] + $usr['timezone'] * 3600),

Is this still correct after the changes in Siena?

]]>
вс, 23 сен 2012 05:53:02 -0000
Trustmaster There's a port I made 10 months ago actually.

]]>
сб, 22 сен 2012 11:19:21 -0000
pieter Perfect. What is soon?

]]>
сб, 22 сен 2012 08:35:03 -0000
Kort Pieter: we'll announce the Recent Comments plugin along with a bunch of others soon. No need for porting.

]]>
сб, 22 сен 2012 08:13:58 -0000
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.

]]>
сб, 22 сен 2012 05:43:31 -0000
SunChase ср, 22 июл 2009 03:32:41 -0000 KillerSneak
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.]]>
ср, 22 июл 2009 02:36:25 -0000
Trustmaster recentcomments plugin in the repository which has been ported. You can download it here.]]> ср, 22 июл 2009 02:32:16 -0000 KillerSneak
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=https://www.cotonti.com/\"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=https://www.cotonti.com/\"page.php?id=$k&amp;comments=1#c".$row['com_id']."\">"." \"".$page_title."\"</a>";
                break;
///////////////////////motor2hg/////////////////////////////////////
case 'v':
$lnk = "<a href=https://www.cotonti.com/\"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?]]>
ср, 22 июл 2009 01:54:26 -0000