Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 04:47 pm EST
Geeklog Forums
Recent comments
Status: offline
::Ben
Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Hello,
This is a social block to show recent comments. You can see it in action here... and make a comment
Feedback are welcome.
::Ben
function phpblock_recentcomments() {
global $_CONF, $_TABLES, $LANG01;
$recentcomments = '<div id="recentcomments">';
// Set the number of comments to show
$limits = 5;
$sql = "SELECT DISTINCT COUNT(*) AS dups, type, st.title as title, c.comment as comment, c.cid as cid, c.uid as uid, st.sid as sid, max(c.date) AS lastdate "
. "FROM {$_TABLES['comments']} c, {$_TABLES['stories']} st "
. "WHERE st.sid = c.sid AND st.draft_flag = 0 AND st.commentcode >= 0 "
. COM_getPermSQL('AND', 0, 2,'st') // notice we can use st here.
. $topicsql
. COM_getLangSQL('sid', 'AND','st')
. "GROUP BY c.sid,type, c.comment, st.title, st.sid, c.cid, c.uid "
. "ORDER BY 5 DESC LIMIT " . $limits;
$result = DB_query( $sql );
$nrows = DB_numRows( $result );
if( $nrows > 0 )
{
$newcomments = array();
for( $x = 0; $x < $nrows; $x++ )
{
$A = DB_fetchArray( $result );
if(( $A['type'] == 'article' ) || empty( $A['type'] ))
{
$url = COM_buildUrl( $_CONF['site_url']
. '/article.php?story=' . $A['sid'] ) . '#comments';
}
$username = COM_getDisplayName( $A['uid'] );
$lastcomment = $A['comment'];
$title = COM_undoSpecialChars( stripslashes( strip_tags( $lastcomment )));
$titletouse = COM_truncate( $title, 80, '...' );
$acomment = str_replace( '$', '$', $titletouse );
$newcomments[] = '<strong>' . $username .'</strong> ' . COM_createLink($acomment, $url);
}
$recentcomments .= COM_makeList( $newcomments, 'recentcomments' );
}
else
{
$recentcomments .= $LANG01[86] . '<br' . XHTML . '>' . LB;
}
$recentcomments .='</div>';
return $recentcomments;
I'm available to customise your themes or plugins for your Geeklog CMS
This is a social block to show recent comments. You can see it in action here... and make a comment
Feedback are welcome.
::Ben
Text Formatted Code
function phpblock_recentcomments() {
global $_CONF, $_TABLES, $LANG01;
$recentcomments = '<div id="recentcomments">';
// Set the number of comments to show
$limits = 5;
$sql = "SELECT DISTINCT COUNT(*) AS dups, type, st.title as title, c.comment as comment, c.cid as cid, c.uid as uid, st.sid as sid, max(c.date) AS lastdate "
. "FROM {$_TABLES['comments']} c, {$_TABLES['stories']} st "
. "WHERE st.sid = c.sid AND st.draft_flag = 0 AND st.commentcode >= 0 "
. COM_getPermSQL('AND', 0, 2,'st') // notice we can use st here.
. $topicsql
. COM_getLangSQL('sid', 'AND','st')
. "GROUP BY c.sid,type, c.comment, st.title, st.sid, c.cid, c.uid "
. "ORDER BY 5 DESC LIMIT " . $limits;
$result = DB_query( $sql );
$nrows = DB_numRows( $result );
if( $nrows > 0 )
{
$newcomments = array();
for( $x = 0; $x < $nrows; $x++ )
{
$A = DB_fetchArray( $result );
if(( $A['type'] == 'article' ) || empty( $A['type'] ))
{
$url = COM_buildUrl( $_CONF['site_url']
. '/article.php?story=' . $A['sid'] ) . '#comments';
}
$username = COM_getDisplayName( $A['uid'] );
$lastcomment = $A['comment'];
$title = COM_undoSpecialChars( stripslashes( strip_tags( $lastcomment )));
$titletouse = COM_truncate( $title, 80, '...' );
$acomment = str_replace( '$', '$', $titletouse );
$newcomments[] = '<strong>' . $username .'</strong> ' . COM_createLink($acomment, $url);
}
$recentcomments .= COM_makeList( $newcomments, 'recentcomments' );
}
else
{
$recentcomments .= $LANG01[86] . '<br' . XHTML . '>' . LB;
}
$recentcomments .='</div>';
return $recentcomments;
I'm available to customise your themes or plugins for your Geeklog CMS
10
7
Quote
All times are EST. The time is now 04:47 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content