Vous n'êtes pas identifié(e).
13 février 2024 Sortie de Dotclear 2.29
Pages : 1
Hello,
By default Last Comments widget shows the comments like that:
Post_Title - Name_Of_Some_Comment_Author3
Post_Title - Name_Of_Some_Comment_Author2
Post_Title - Name_Of_Some_Comment_Author1
(if the last 3 comments was on the same post)
I would like to change it to:
Last_Post_Title - Number_Of_Comments_For_Last_Post_Title
Previously_Commented_Post_Title - Number_Of_Comments_For_PCPT
One_Before_Previously_Commented_Post_Title - Number_Of_Comments_For_OBPCPT
Is it possible? Which file need to be modified?
Any help appreciated.
Hors ligne
OK, I've found the code in plugins/widgets/_widget_functions.php:
public static function lastcomments($w)
{
global $core;
if (($w->homeonly == 1 && $core->url->type != 'default') ||
($w->homeonly == 2 && $core->url->type == 'default')) {
return;
}
$params['limit'] = abs((integer) $w->limit);
$params['order'] = 'comment_dt desc';
$rs = $core->blog->getComments($params);
if ($rs->isEmpty()) {
return;
}
$res = ($w->content_only ? '' : '<div class="lastcomments'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">').
($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : '').
'<ul>';
while ($rs->fetch())
{
$res .= '<li class="'.
((boolean)$rs->comment_trackback ? 'last-tb' : 'last-comment').
'"><a href="'.$rs->getPostURL().'#c'.$rs->comment_id.'">'.
html::escapeHTML($rs->post_title).' - '.
html::escapeHTML($rs->comment_author).
'</a></li>';
}
$res .= '</ul>'.($w->content_only ? '' : '</div>');
return $res;
}
It's probably last 10 lines to be modified. Unfortunately I'm less than noob in php :(
Hors ligne
View this plugin.
Hors ligne
Hello Jean-Michael,
Thank you for quick answer. It's big progress, but this plugin does only part of the job. Now I have comment title + date showing, and that's good :-)
The missing part is:
When 2 persons or more add a comment to the same post (for example, at the same day), the same post title is showing 3 times, because DC counts the same post three times
The same post title
The same post title
The same post title
The goal is to get this order:
Title of last commented post
Diffrerent title of previous commented post
Another different post title from the past
(Sorry for my English, not a native speaker)
Dernière modification par jarekb (2014-10-02 21:27:11)
Hors ligne
Pages : 1
Vous n'êtes pas identifié(e).