"I would like to see a direct news url after adding the news"
to do that we would need to know exactly where the news is being included,
to link to news we would need to know where the news is, and since this is a different on almost every site, it's not going to be easy...
but an advanced preview news page may be nice https://cutephp.com/forum/style_emoticons/default/smile.gif ... *ponders

Because I hate reinstalling all my hacks all over again with every new Cutenews version


then shouldnt we be asking for a different hack system, so files dont have to be edited as much

admin template for each user level - so lets say commenter would have a different looking admin area, admins a different template, editors as well, etc. etc. So far I can see that you can change the template for the admin area, but not for user groups


open index.php & remove:

if(isset($config_skin) and $config_skin != "" and file_exists("./skins/${config_skin}.skin.php")){
        require_once("./skins/${config_skin}.skin.php");
}else{
        $using_safe_skin = true;
        require_once("./skins/default.skin.php");
}

find:

// If User is Not Logged In, Display The Login Page

add above

if($member_db[1] == 1)$config_skin = "default"; // skin for admins
elseif($member_db[1] == 2)$config_skin = "simple"; // skin for editors
elseif($member_db[1] == 3)$config_skin = "simple"; // skin for jurnalists
elseif($member_db[1] == 4)$config_skin = "compact"; // skin for commenters
if(isset($config_skin) and $config_skin != "" and file_exists("./skins/${config_skin}.skin.php")){
        require_once("./skins/${config_skin}.skin.php");
}else{
        $using_safe_skin = true;
        require_once("./skins/default.skin.php");
}

lol, cuteftp https://cutephp.com/forum/style_emoticons/default/tongue.gif i think your a bit mixed up there popojoe https://cutephp.com/forum/style_emoticons/default/happy.gif
but language packs for cutenews realy needs to be added,

Name: Position comments & comment form
Author: eyece
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: i have seen a few people asking how to change the order that the comments & comment form are added to the page, so heres a mod that allows you to pick where to include them in the full story template using {comments}, {comments-form} and {comments-pagination}
Instructions:

inc/shows.inc.php
find:

echo $output;
                                        $showed_comments++;

replace:

$comments_output .= $output;
                                        $showed_comments++;


find:

    if        (!$no_prev or !$no_next){
            echo $prev_next_msg;
    }

replace:

    if        (!$no_prev or !$no_next){
            $comments_pagi_output = $prev_next_msg;
    }


find:

echo"<form  $CN_remember_form  method=\"post\" name=\"comment\" id=\"comment\" action=\"\">".$template_form."<div><input type=\"hidden\" name=\"subaction\" value=\"addcomment\" /><input type=\"hidden\" name=\"ucat\" value=\"$ucat\" /><input type=\"hidden\" name=\"show\" value=\"$show\" />$user_post_query</div></form>
                    \n $CN_remember_include";

replace:

$comments_form_output = "<form  $CN_remember_form  method=\"post\" name=\"comment\" id=\"comment\" action=\"\">".$template_form."<div><input type=\"hidden\" name=\"subaction\" value=\"addcomment\" /><input type=\"hidden\" name=\"ucat\" value=\"$ucat\" /><input type=\"hidden\" name=\"show\" value=\"$show\" />$user_post_query</div></form>
                    \n $CN_remember_include";
if(!$allow_full_story){echo $comments_output.$comments_pagi_output.$comments_form_output;}


find:

$output = replace_news("show", $output);

                        echo $output;

replace:

                        $output = replace_news("show", $output);
                        $output = str_replace("{comments}", $comments_output, $output);
                        $output = str_replace("{comments-form}", $comments_form_output, $output);
                        $output = str_replace("{comments-pagination}", $comments_pagi_output, $output);
                        echo $output;


next move the entire "Show Full Story" section of shows.inc.php down to below the "Show Comments" section

then your done https://cutephp.com/forum/style_emoticons/default/smile.gif now you can position the comments, comment form & pagination to anywhere in your full-story template in any order
if anyone has any addons, requests, problems, just ask

note: if the full story is not showen with the comments, the comments will go back to default order/position, so "Show Full Story When Showing Comments" in system config should be set to yes

6

(1 replies, posted in Hacks & Tricks / FAQ)

Name: Counter
Author: Eyece, liketobemad added a small modification
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: Keep statistics on your articles.
Discussion Topic:  here
Instructions:
first put this in a file named counter.php in the cutenews core folder:

<?php

if(!$cn_do)die;

$file_path = $cutepath.'/data/counter.txt';
$online_timeout = 120; // seconds
$ip = $_SERVER['REMOTE_ADDR'];
$time = time();

// load current stats into array
$counter = array();
foreach(file($file_path) as $line_num => $line){
    $line = explode("|",$line);
    $counter[$line[0]] = array("views"=>0,"unique views"=>0,"online"=>0);
    if($line[1]!="")
        foreach(explode(" ",$line[1]) as $part_num => $part){
            $part = explode(":",$part);
            if($part[3]>=($time-$online_timeout))$counter[$line[0]]["online"] += 1;
            $counter[$line[0]]["views"] += $part[1];
            $counter[$line[0]][$part[0]] = array($part[1],$part[2],$part[3]);
            $counter[$line[0]]["unique views"] += 1;
        }
}

if($cn_do=="update"){
    // update or write this users stats
    if(is_array($counter[$id])){
        if(is_array($counter[$id][$ip])){
            $counter[$id][$ip][0] += 1;
            $counter[$id]["views"] += 1;
            $counter[$id][$ip][2] = $time;
        }
        else{
            $counter[$id][$ip] = array(1,$time,$time);
            $counter[$id]["unique views"] += 1;
        }
    }
    elseif(is_numeric($id))$counter[$id] = array("views"=>1,"unique views"=>1,"online"=>0,$ip=>array(1,$time,$time));
    
    // re-write counter stats
    $fp = fopen($file_path,"w");
    $write = $counter;
    foreach($write as $item_id => $item_logs){
        foreach($item_logs as $log_ip => $log_values)
            if(is_array($log_values)){
                $write[$item_id][$log_ip] = $log_ip.":".implode(":",$log_values);
            }
            else unset($write[$item_id][$log_ip]);
        $write[$item_id] = $item_id."|".implode(" ",$write[$item_id])."|";
    }
    fwrite($fp,implode("\n",$write));
    fclose($fp);
}

?>


then create a blank file named counter.txt in the data folder (chmod 777)

shows.inc.php
find:

$output = str_replace("{title}", $news_arr[2], $template_full);

add under:

    $cn_do = "update";
        include($cutepath.'/counter.php');
        $output = str_replace("{page-views}", $counter[$news_arr[0]]["views"], $output);
        $output = str_replace("{unique-views}", $counter[$news_arr[0]]["unique views"], $output);
        $output = str_replace("{your-views}", $counter[$news_arr[0]][$ip][0], $output);
        $output = str_replace("{online}", $counter[$news_arr[0]]["online"], $output);
        $output = str_replace("{first-view}", date($config_timestamp_active,$counter[$news_arr[0]][$ip][1]), $output);


find:

$output = $template_active;

add under:

    $cn_do = "get";
        include($cutepath.'/counter.php');
        $output = str_replace("{page-views}", $counter[$news_arr[0]]["views"], $output);
        $output = str_replace("{unique-views}", $counter[$news_arr[0]]["unique views"], $output);
        $output = str_replace("{your-views}", $counter[$news_arr[0]][$ip][0], $output);
        $output = str_replace("{online}", $counter[$news_arr[0]]["online"], $output);
        $output = str_replace("{first-view}", date($config_timestamp_active,$counter[$news_arr[0]][$ip][1]), $output);

you can now use the following in the full-story & short-story templates:
{page-views} - total page loads from all unique visitors to current news
{unique-views} - count of all ip's logged in log file that are listed under the current news id
{your-views} - times viewer has loaded the page/news
{online} - count of all viewers that have been active within the timeout limit
{first-view} - time viewer first viewed news

Author: eyece & Ifa
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: Disable the comments link when listing the news and commenting isn't allowed.
Requirements: this hack
Instructions:
in shows.inc.php find 2 times

if($config_comments_popup == "yes"){
                        $output = str_replace("[com-link]","[url=]", $output);
                }else{
                        $output = str_replace("[com-link]","<a href=\"$PHP_SELF?subaction=showcomments&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query\">", $output);
                }
                $output = str_replace("[/com-link]","[/url]", $output);


replace with both with

if($news_arr[7] == "yes"){
$output = str_replace("[com-link]","-Comments Disabled-<!--", $output);
$output = str_replace("[/com-link]","-->", $output);
}
else{
                    if($config_comments_popup == "yes"){
                                $output = str_replace("[com-link]","[url=]", $output);
                        }else{
                                $output = str_replace("[com-link]","<a href=\"$PHP_SELF?subaction=showcomments&id=$news_arr[0]&archive=$archive&start_from=$my_start_from& amp;ucat=$news_arr[6]&$user_query\">", $output);
                        }
                        $output = str_replace("[/com-link]","[/url]", $output);
}


find 2 times

$output = str_replace("{comments-num}", countComments($news_arr[0], $archive), $output);

replace both with

$output = str_replace("{comments-num}", (($news_arr[7] == "yes")?'':countComments($news_arr[0], $archive)), $output);

i dont see why he would make a hack that doesnt work for 1.4

i have a cool addon idea... it would be very awsome if you could have it, each user name would have an alt=
the alt would be a comment that the person posted
so on mouse over it would show what the persons comment is smile

and could you limit how many names it shows? like after the 10th name it would put "..."

is there a concensored (hope i typed that right ^-^) word function?
im sick of people flame'n me in comments and in there names
if there isnt you may want to apply one

Posts found: 9

Pages 1

CutePHP Forums → Posts by eyece



The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.