Topic: News go to top on a new comment

Hello everyone, how can i make the news go to top or up, when a new comment is posted?

like a "up" comment...

because, i trying to make a forum with cutenews, and just need this...

and sorry for the english..i'm a brazilian guy...  http://cutephp.com/forum/style_emoticons/default/rolleyes.gif

Re: News go to top on a new comment

up =X  http://cutephp.com/forum/style_emoticons/default/unsure.gif

3 (edited by 2012-05-29 11:22:45)

Re: News go to top on a new comment

Dear User!

Our programmers have created a script  which you should insert after the code in inc/shows.inc.php:

if($allow_active_news){

        $all_news = file("$news_file");
    if($reverse == TRUE){ $all_news = array_reverse($all_news); }

the scipt code:

    // Search last comments
    if ( !empty($sortbylast) )
    {
        $garnews = array();
        foreach ($all_news as $nl) { list ($id) = explode('|', $nl, 2); $garnews[$id] = $nl; }
        $all_news = array();

        $all_comments = file($comm_file);
        $all_comments = preg_replace('~^(\d+)\|>\|((\d+)\|.*?\|.*?\|.*?\|.*?\|.*?\|)*~im', '\\3.\\1', $all_comments);
        arsort($all_comments);
        foreach ($all_comments as $pm) if ( $nl = rtrim($garnews[ (int)(substr($pm, strpos($pm, '.') + 1)) ]) ) $all_news[] = $nl;
    }

Before to turn on show_news.php please set the parameter $sortbylast = 1

Best regards,
CN Support team

4 (edited by 2012-05-29 17:33:06)

Re: News go to top on a new comment

nice, but I have more 2 questions.

How can a choose a template to do this  like a "Forum" template and if I post a new "News", the news stay at the top, and if JUST I post a comment, the news go to top..

exemple: I have 3 news:

NEWS 2 (3 comment)
NEWS 3 (1 comment)
NEWS 1 (2 comment)

I post a more one news, but the news go to last stage:

NEWS 2 (3 comment)
NEWS 3 (1 comment)
NEWS 1 (2 comment)
NEWS 4 (0 comment)

I need if I post the news, the news will go to top like:

NEWS 4 (0 comment)
NEWS 2 (3 comment)
NEWS 3 (1 comment)
NEWS 1 (2 comment)

again, sorry for my english..kkk

and thanks for the admins..

follow the website : www.inf-gaming.com.br/index, the website is in Portuguese-BR, and the Forum stay at the right column after login...

Re: News go to top on a new comment

Dear User,
Thank you for your remark.
Unfortunately, this functionality is not supported by CuteNews 1.4.7, but we are going to include it in future versions.

Best regards,
CN Support team