Gossamer Forum
Quote Reply
number of new reviews
Hi Andy,
I'm trying to print the number of new reviews with this global
Code:
sub { $DB->table('Reviews')->count( { isNew => 'Yes', isValidated => 'Yes' } ) }

but I have no outout at all :-(

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] number of new reviews In reply to
Hi,

isNew and isValidated isn't valid for Reviews ;)

So what are you trying to do - get the last xx reviews added in the last 7 days? (for example)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] number of new reviews In reply to
Hi Andy,
I'm using this global. Don't know why, but it seems to work for me. Cause it shows only four new reviews.
Code:
sub {
my (@links,$sth,$link);
my $search_db = $DB->table('Links','Reviews');
$search_db->select_options ("ORDER BY Review_Date DESC", "LIMIT 10");
$sth = $search_db->select ( { isValidated => "Yes" } , { isNew => "Yes" } , { Review_Validated => 'Yes' });
while (my $link = $sth->fetchrow_hashref()) {
if (length $link->{Title} > 70) {
$link->{Title} = substr($link->{Title}, 0, 50) . '...';}
$link = Links::SiteHTML::tags('link', $link);
$link->{detailed_url} = $CFG->{build_detail_url} . "/" . $DB->table('Links')->detailed_url( $link->{ID} );
if (length $link->{Review_Contents} > 500) {
$link->{Review_Contents} = substr($link->{Review_Contents}, 0, 500) . '...';}
push@links, $link;
}
return {All_new_Reviews=>\@links};

}
Now I just want a global like this
Code:
sub { $DB->table('Reviews')->count( { isNew => 'Yes', isValidated => 'Yes' } ) }
to show how many new reviews are there...

Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] number of new reviews In reply to
Hi,

The global above is doing:

Find links that are isValidated => Yes, and isNew => Yes (in the Links table)
AND then also the Review_Validated => Yes in the "Reviews" table

However, I doubt thats what you are after ;)

If you wanna get say the latest reviews added, you could try changing:

$sth = $search_db->select ( { isValidated => "Yes" } , { isNew => "Yes" } , { Review_Validated => 'Yes' });

..to simply:

$sth = $search_db->select ( { isValidated => "Yes" } , { Review_Validated => 'Yes' });

To find the total number of new reviews in a set period, try something like:

get_latest_review_count
Code:
sub {
my $_x_days_ago = GT::Date::date_sub(GT::Date::date_get(),7);
my $total = $DB->table('Links','Reviews')->count ( { isValidated => "Yes" } , GT::SQL::Condition->new('Review_Validated','=','Yes','Review_Date','>=',$_x_days_ago) );
return $total || 0;
}

This will get the total number of reviews, over the last 7 days.

Untested, but should work Wink

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] number of new reviews In reply to
Thanks Andy,
I works perfect, what else Smile

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] number of new reviews In reply to
Angelic

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!