Welcome to Geeklog Thursday, April 22 2021 @ 09:14 pm EDT

Geeklog Forums

The text "1 comments"


Status: offline

Benson

Forum User
Newbie
Registered: 06/01/04
Posts: 6
Could that be changed? Without going to "1 comment(s)"?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
Could you rephrase your question, please? I have no idea what you mean ...

bye, Dirk
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 20/10/03
Posts: 807
I think he wants the stories to display "1 comment" instead of "1 comments" on the main page.

If that's the case, in lib-common.php, in COM_article, change the following:
PHP Formatted Code
if( $A['comments'] > 0 )
{
    $article->set_var( 'comments_url', $_CONF['site_url']
        . '/article.php?story=' . $A['sid'] . '#comments' );
    $article->set_var( 'comments_text', $A['comments'] . ' '
        . $LANG01[3] );
    $article->set_var( 'comments_count', $A['comments'] );
    $article->set_var( 'lang_comments', $LANG01[3] );

    $result = DB_query( "SELECT UNIX_TIMESTAMP(date) AS day,username FROM {$_TABLES['comments']},{$_TABLES['users']} WHERE {$_TABLES['users']}.uid = {$_TABLES['comments']}.uid AND sid = '{$A['sid']}' ORDER BY date desc LIMIT 1" );
    $C = DB_fetchArray( $result );

    $recent_post_anchortag = '<span class="storybyline">'
        . $LANG01[27] . ': '
        . strftime( $_CONF['daytime'], $C['day'] ) . ' '
        . $LANG01[104] . ' ' . $C['username'] . '</span>';
    $article->set_var( 'start_comments_anchortag', '<a href="'
        . $_CONF['site_url'] . '/article.php?story=' . $A['sid']
        . '#comments">' );
    $article->set_var( 'end_comments_anchortag', '</a>' );
}


 


to

PHP Formatted Code
if( $A['comments'] > 0 )
{
    $article->set_var( 'comments_url', $_CONF['site_url']
        . '/article.php?story=' . $A['sid'] . '#comments' );
    if ($A['comments'] == 1)
    {
        $article->set_var( 'comments_text', $A['comments'] . ' comment' );
    }
    else
    {
        $article->set_var( 'comments_text', $A['comments'] . ' comments' );
    }
    $article->set_var( 'comments_count', $A['comments'] );
    $article->set_var( 'lang_comments', $LANG01[3] );

    $result = DB_query( "SELECT UNIX_TIMESTAMP(date) AS day,username FROM {$_TABLES['comments']},{$_TABLES['users']} WHERE {$_TABLES['users']}.uid = {$_TABLES['comments']}.uid AND sid = '{$A['sid']}' ORDER BY date desc LIMIT 1" );
    $C = DB_fetchArray( $result );

    $recent_post_anchortag = '<span class="storybyline">'
        . $LANG01[27] . ': '
        . strftime( $_CONF['daytime'], $C['day'] ) . ' '
        . $LANG01[104] . ' ' . $C['username'] . '</span>';
    $article->set_var( 'start_comments_anchortag', '<a href="'
        . $_CONF['site_url'] . '/article.php?story=' . $A['sid']
        . '#comments">' );
    $article->set_var( 'end_comments_anchortag', '</a>' );
}


 
 Quote

Status: offline

Benson

Forum User
Newbie
Registered: 06/01/04
Posts: 6
After each story, the number of comments are displayed (at least in the themes I've looked at).

Quote by Dirk: Could you rephrase your question, please? I have no idea what you mean ...
 Quote

Status: offline

Benson

Forum User
Newbie
Registered: 06/01/04
Posts: 6
Yes, Turias got it. I'll make the change - TKS
 Quote

Status: offline

Benson

Forum User
Newbie
Registered: 06/01/04
Posts: 6
Fixed - thanks!
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 20/10/03
Posts: 807
Just note that I quickly hardcoded it so that it will only display in English. If you want this to work for other languages, you will have to do more mucking around in the language files.
 Quote

All times are EDT. The time is now 09:14 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