Welcome to Lethal Pink, a personal site of a not so personal woman. Here in my little web world you will find a variety of things to spark your interests. Have a look around and comment if you feel compelled. Got a question? Feel free to ask and I'll answer at my discretion. Enjoy your time and come back soon!
The name's Charity, aka CeCe. Happily married. Gemini. Proud Christian. Dog lover. Obnoxiously loud. Fatally flawed. Random. Brutally honest. Girl gamer. TV addict. Fanfic writer. Music lover. Wannabe DJ. Former dancer. Forever Nerdy. Mildly obsessive. Way compulsive. Wanna know more?
 

Plug Commenters with Cutenews

Connect to your FTP server and go to the directory where you have cutenews installed. Go to inc > functions.inc.php. Find the last line at the end of the file and right before the closing ?> add this code:

////////////////////////////////////////////////////////////////
//// Function: Lists all commenters with mail or url when available
function list_commenters($news, $linebreak, $separator) {
$alle_comments = file("cutenews/data/comments.txt");
$i=0;
foreach($alle_comments as $comments_line)
{
$comments_line = trim($comments_line);
$comments_line_arr = explode("|>|", $comments_line);
if($news == $comments_line_arr[0])
{
$individual_comment = explode("||", $comments_line_arr[1]);
foreach ($individual_comment as $single_comment)
{
$single_comment_arr = explode("|", $single_comment);
if (($single_comment_arr[0] != "") && (!stristr($output, $single_comment_arr
[1])))
{
$i++;
if($single_comment_arr[2] != "none")
{
if( preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}
$/", $single_comment_arr[2])){ $url_target = "";$mail_or_url = "mailto:"; }
else
{
$url_target = "target=\"_blank\"";
$mail_or_url = "";
if(substr($single_comment_arr[2],0,3) == "www") $mail_or_url = "http://";
}
$output .= "<a $url_target href=\"$mail_or_url".stripslashes
($single_comment_arr[2])."\">".stripslashes($single_comment_arr
[1])."</a>".$separator;
}
else $output .= $single_comment_arr[1].$separator;
if (fmod($i, $linebreak)==0) $output .= "<br />";
}
}

}
}
if (fmod($i, $linebreak)=="0") $output = substr($output, 0, -(strlen
($separator)+6));
else $output = substr($output, 0, -strlen($separator));
return $output;
}

Now open up shows.inc.php and find this:

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

Add this just below it:

preg_replace("#\[commenters-header\](.*?)\[/commenters-
header\]#i", "", $output);

Then in the same shows.inc.php file find the following code:

$output = $template_active;

Add this code below it:

if(CountComments($news_arr[0], $archive) > 0){
$output = str_replace('[commenters-header]', '', $output);
$output = str_replace('[/commenters-header]', '', $output);
$output = preg_replace("#\{commenters:(.*):(.*)\}#ie", "list_commenters
('".$news_arr[0]."', '\\1', '\\2')", $output);
}
else $output = preg_replace("#\[commenters-header\](.*?)\[/commenters-
header\]#i", "", $output);

Now log into your Cutenews admin panel and go to Options > Edit Templates place the code below in your active news and full story templates where you want to plug your commenters:

[commenters-header]{commenters:#: - }[/commenters-header]

Replace # with the number of commenters per row you want to display. Save your changes and that's it your commenters should be plugged!





← previous | refresh | forward →


LethalPink is powered by WordPress © 2011 unless stated otherwise