Gossamer Forum
Home : Products : Links 2.0 : Customization :

Comments 4 Lite Problem

Quote Reply
Comments 4 Lite Problem
I am getting an error when I install Comments 4 lite. It is with the changes to site_html_link. When I add to the sub I get the following error...

Error including libraries: syntax error at /home/cbeach/public_html/restaurants/cgi/admin/site_html_templates.pl line 57, near "my"
syntax error at /home/cbeach/public_html/restaurants/cgi/admin/site_html_templates.pl line 73, near "})"

Also I am not sure where totals => $totals is suppose to go. I know it says at the end of the sub but you have to be specific with me. I am great at cutting and pasting but that is about it.

Thanks in advance.

Quote Reply
Re: Comments 4 Lite Problem In reply to
Please paste what you have for the top 100 lines of site_html_templates.pl

(Not including the copyright stuff)

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: Comments 4 Lite Problem In reply to
Here it is. Thank you very much....


# You can put variables here that you would like to use in any
# of your templates.

%globals = (
date => &get_date,
time => &get_time,
db_cgi_url => $db_cgi_url,
build_root_url => $build_root_url,
site_title => $build_site_title,
css => $build_css_url,
banner => ''
);


sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like.

my %rec = @_;

# Set new and pop to either 1 or 0 for templates.
($rec{'isNew'} eq 'Yes') ? ($rec{'isNew'} = 1) : (delete $rec{'isNew'});
($rec{'isPopular'} eq 'Yes') ? ($rec{'isPopular'} = 1) : (delete $rec{'isPopular'});

return &load_template ('link.html', {
detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",
%rec,
%globals
});
}
my (@values, $counter, $totals);
$counter = 0;
open (DB, "<$db_comments_name") or &cgierr("unable to open database: $db_comment_name. Reason: $!");
LINE: while (<DB> ) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$counter = $values[1];
if ($rec{'ID'} eq $counter) {
$totals++;
}
}
close DB;

totals => $totals,



sub site_html_home {
# --------------------------------------------------------
# This routine will build a home page. It is not meant to have any
# links on it, only subcategories.

return &load_template ('home.html', {
category => $category,
grand_total => $grand_total,
%globals
});
}

sub site_html_new {
# --------------------------------------------------------
# This routine will build a what's new page.

return &load_template ('new.html', {
total => $total,
grand_total => $grand_total,
link_results => $link_results,
title_linked => $title_linked,
%globals
} );
}


Quote Reply
Re: Comments 4 Lite Problem In reply to
Hi Michelle,

Here is where I put mine:

######comments
my (@values, $counter, $totals);
$counter = 0;
open (DB, "<$db_comments_name") or &cgierr("unable to open database: $db_comment_name. Reason: $!");
LINE: while (<DB> ) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$counter = $values[1];
if ($rec{'ID'} eq $counter) {
$totals++;
}
}
close DB;
#####end of comments#####
return &load_template ('link.html', {
new_mod_img => $new_mod_img,
detailed_url => "$build_detail_url/$rec{'ID'}$build_extension",
rate_img => $rate_img,
totals => $totals,
%rec,
%globals
});
}


Towards the end of sub site_html_link. I have other mods so you would need to edit to your code.

Hope that helps.

Madonna

Quote Reply
Re: Comments 4 Lite Problem In reply to
Yes Madonna's version is correct - you have added the code outside of the sub so it will cause errors - just copy Madonna's version and it should be fine.

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: Comments 4 Lite Problem In reply to
Many, many thanks...worked perfectly.

Quote Reply
Re: Comments 4 Lite Problem In reply to
i have another problem.. it seems that the posts are not sorted properly..

http://removed..

Quote Reply
Re: Comments 4 Lite Problem In reply to
Oops sorry, I was a bit premature there!Blush Ahh think I know what the problem is. At the moment you have them sorted in reversre order! To fix it change:


<input type="radio" checked name="Rating" value="0"><img src="http://www.lazyjuice.com/images/searchsg/r-love.gif" alt="Love">
<input type="radio" name="Rating" value="1"><img src="http://www.lazyjuice.com/images/searchsg/r-biggrin.gif" alt="Big Grin">
<input type="radio" name="Rating" value="2"><img src="http://www.lazyjuice.com/images/searchsg/r-shocked.gif" alt="Shocked">
<input type="radio" name="Rating" value="3"><img src="http://www.lazyjuice.com/images/searchsg/r-cool.gif" alt="Cool">
<input type="radio" name="Rating" value="4"><img src="http://www.lazyjuice.com/images/searchsg/r-rolleyes.gif" alt="Roll Eyes">
<input type="radio" name="Rating" value="5"><img src="http://www.lazyjuice.com/images/searchsg/r-frown.gif" alt="Frown">



To:

<input type="radio" checked name="Rating" value="5"><img src="http://www.lazyjuice.com/images/searchsg/r-love.gif" alt="Love">
<input type="radio" name="Rating" value="4"><img src="http://www.lazyjuice.com/images/searchsg/r-biggrin.gif" alt="Big Grin">
<input type="radio" name="Rating" value="3"><img src="http://www.lazyjuice.com/images/searchsg/r-shocked.gif" alt="Shocked">
<input type="radio" name="Rating" value="2"><img src="http://www.lazyjuice.com/images/searchsg/r-cool.gif" alt="Cool">
<input type="radio" name="Rating" value="1"><img src="http://www.lazyjuice.com/images/searchsg/r-rolleyes.gif" alt="Roll Eyes">
<input type="radio" name="Rating" value="0"><img src="http://www.lazyjuice.com/images/searchsg/r-frown.gif" alt="Frown">

Glenn

Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
Quote Reply
Re: Comments 4 Lite Problem In reply to
http://www.lazyjuice.com/...chsg/open.cgi?f=info

ur credits are here... sorrie cos i use so many of ur mods and having them everybody is not very nice for the site... kekekkeke thanks...

Quote Reply
Re: Comments 4 Lite Problem In reply to
Just edited above post...

Nice site by the way, like the little face images, very cool!

Glenn

Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
Quote Reply
Re: Comments 4 Lite Problem In reply to
ohhhhhhhh.. my mistake.... i didn't know it is sorted by ratings.... sorrie... so is it possible to sort the posts by the date it was posted? means... the latest post on the top?

sorrie again for not mentioning wat the problem was... :)

in addition... is it possible to span pages to be include in the comments 4 lite? cos i think it is a veri important feature. the reviews can get really long.... i know it is coming out for comments 4 advanced but... i really dunno how to pay for it.. and i think it is just the inclusion of one more feature to make it complete for me. thanks..
Quote Reply
Re: Comments 4 Lite Problem In reply to
Sorry for the moment I'm doing no more alterations for any of my mods. I have v important exams which take priority. Then after that I have to look for job which also gets priority. Then carry out work for paying customers which I haven't had time to do yet plus have a holiday!(all these get prioity over spending my time posting more free mods).

Also as I mentioned before I am not adding any more features to comments 4lite. Plus I going to concentrate more on paid mods such as a link center and the goto.com mod.

Glenn

Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
Quote Reply
Re: Comments 4 Lite Problem In reply to
ohhhhh kay... sorrie for asking u abt the spanning page... but can u ppppllllls plssssss teach me how to sort according to date posted?

Quote Reply
Re: Comments 4 Lite Problem In reply to
In sub display under:

$links++;
Add:

$id = $values[0];

Then change:

push (@{$comment{$rating}}, @values)

To:

push (@{$comment{$id}}, @values)


Then change:


HITS: foreach $rating (sort {$b <=> $a} keys %comment) {

LINK: for ($i = 0; $i < ($#{$comment{$rating}}+1) / ($#db_cols + 1); $i++) {

%tmp = &array_to_hash ($i, @{$comment{$rating}});
$links_out{$rating} .= &site_html_commenter2 (%tmp) . "\n";
}
}
foreach $rating (sort {$b <=> $a} keys %links_out) {
$lcomments .= $links_out{$rating};
}


To:

HITS: foreach $id (sort {$b <=> $a} keys %comment) {

LINK: for ($i = 0; $i < ($#{$comment{$id}}+1) / ($#db_cols + 1); $i++) {

%tmp = &array_to_hash ($i, @{$comment{$id}});
$links_out{$id} .= &site_html_commenter2 (%tmp) . "\n";
}
}
foreach $id (sort {$b <=> $a} keys %links_out) {
$lcomments .= $links_out{$id};
}


This'll sort by id instead. You could sort by date but by id is effectively going to do the same thing. If sorting by date you'd change the relevent pieces and also use:

&days_old($sortby{$b}) <=> &days_old($sortby{$a});


Glenn

Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
Quote Reply
Re: Comments 4 Lite Problem In reply to
Thanks.. it worked!