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? |
|
Dieser Beitrag wurde von KillerSneak (am 22. Juli 2009, 02:12, vor 15 Jahre) bearbeitet |