Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Hotscripts type of new listings ?

Quote Reply
Hotscripts type of new listings ?
I want to be able to have my new listings listed the way hotscripts.com has it.

Can anyone shed some light on how I would be able todo this ?

Thanks in advance

Smile
Quote Reply
Re: [incik] Hotscripts type of new listings ? In reply to
Hi incik,

Since no-one has replied to your post I thought I might.

Tuesday, July 30 2002 (24)
- ASP (5) - C and C++ (1) - CFML (1) - Java (2) - JavaScript (1) - PHP (12) - Perl (2)


Certainly this could be done by a global and corresponding tag inserted into your cool template.

You need to retrieve the number of links flagged as new for each categorygrouping. This could be acheived by creating a new coloum which groups every other category into one of the required groups (whatever you are wanting on your own site).

New Column in Category: Category Type, ENUM ['ASP','PHP' etc].

Then perform a select statement on Links for each category type to fetch the number of new links in that category. You could then hyperlink the Title and corresponding count to the category quite easily.

Or, if it is just the top level categories you want to group by, use a function whcih checks all subcategories for the 'new' flag, until they hit a FatherID of 0, totaling up as it goes.... this could be a little ugly to write.

I apologise for not posting any code examples. (I think my keyboard is about to konk) -- it took me 10 minutes just to type this!


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] Hotscripts type of new listings ? In reply to
I've never written a script/function would you be able to write the global for me ?

If anyone has already done this can you please help out ?

Thanks

Smile
Quote Reply
Re: [incik] Hotscripts type of new listings ? In reply to
it'll be nice if somebody can do this, the hotscript type of new listing looks fascinating...
Quote Reply
Re: [xpert] Hotscripts type of new listings ? In reply to
Hmm.
I did not pay too much attention to this thread until now, but now when I did read it, I found it is very similar to the grouping feature, I want to implement to my Xtended Link Display plugin.

I will likely create a new plugin, related to the new link pages. It will likely named as Xtended New Link Display plugin.
It will have several features known from Links 2.0 and LSQL, and new features I already developed & are working on my website.

I implemented a new grouping feature, which is able to group by a selected field, then list them separated with group separators.
Also there is a quicklink feature to be able to jump to beginning of a group, on the same page.

I also see possibilities to implement your "Hotscripts type of new listings" suggestion into the plugin.
There are a lot developments going now, so development this plugin will not started in the near future.
I already have several of my plugins in working state, but as you may know, a long time is needed, until the plugin reaches the release-ready state.
So very likely the Xtended New Link Display plugin will be not released this year(2002), and will be deferred to 2003.

I just wanted to notify you, that there is somebody who want to implement this feature into a plugin.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Hotscripts type of new listings ? In reply to
Alex, would you be able to please help out with this one?

Regards,

Blake
Quote Reply
Re: [blakeb] Hotscripts type of new listings ? In reply to
anyone ever do this or something like it?
Quote Reply
Re: [kzap] Hotscripts type of new listings ? In reply to
Think this should work for all new links - takes a little modification to show new links per date:

sub {
my $output;
my $cat_db = $DB->table('Category');

$cat_db->select_options('ORDER BY Full_Name');
my $sth = $cat_db->select ( {'FatherID' => 0}, ['ID','Full_Name','Name'] );
while (my ($id,$cat,$heading) = $sth->fetchrow_array) {
my $all_ids = $DB->table('Category')->children($id);

my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','isNew','=','Yes','CategoryID', 'IN', $all_ids);
my $count = $link_db->count($condition);

my $url = $cat_db->as_url($cat);
$output .= qq~<a href="$CFG->{build_root_url}/$url">$heading</a> ($count)&nbsp;~;
}
return $output;
}

Last edited by:

afinlr: Oct 4, 2003, 7:39 AM
Quote Reply
Re: [afinlr] Hotscripts type of new listings ? In reply to
sub {

my $date = shift;

my $cat_db = $DB->table('Category');
$cat_db->select_options('ORDER BY Full_Name');
my $sth = $cat_db->select ( {'FatherID' => 0}, ['ID','Full_Name','Name'] );
while (my ($id,$cat,$heading) = $sth->fetchrow_array) {
my $all_ids = $DB->table('Category')->children($id);
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new(['Add_Date','=',$date],['isValidated','=','Yes'],['isNew','=','Yes'],['CategoryID','IN',$all_ids]);
my $count = $link_db->count($condition);
my $url = $cat_db->as_url($cat);
$output .= qq~<a href="$CFG->{db_cgi_url}/page.cgi?p=new_scripts;ID=$id;date=$date">$heading</a> ($count)&nbsp;~;

}

return $output;

}

ok I it almost working, the thing is though that the date passed from the new.html template is in the format of "Wednesday, October 1 2003"

How would I convert that to like 2003-10-01 so I can match it with Add_Date ?

Would I convert it in the global or in the template before I pass it onto the global?
Quote Reply
Re: [kzap] Hotscripts type of new listings ? In reply to
Just add a line after the shift line:

$date = GT::Date::date_transform($date,"%dddd%,%mmmm% %d% %yyyy%","%yyyy-%mm%-%dd%");

That's off the top of my head so you may need to check the format is correct if it doesn't work. You may also need a line

use GT::Date;

at the top of the global if it complains.
Quote Reply
Re: [afinlr] Hotscripts type of new listings ? In reply to
sub {

my $date shift;
my $output;
use GT::Date qw/:all/;
$date = GT::Date::date_transform($date,"%dddd%, %mmmm% %dd% %yyyy%","%yyyy%-%mm%-%dd%");
my $cat_db = $DB->table('Category');
$cat_db->select_options('ORDER BY Full_Name');
my $sth = $cat_db->select ( {'FatherID' => 0}, ['ID','Full_Name','Name'] );
while (my ($id,$cat,$heading) = $sth->fetchrow_array) {
my $all_ids = $DB->table('Category')->children($id);
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new(['Add_Date','=',$date],['isValidated','=','Yes'],['isNew','=','Yes'],['CategoryID','IN',$all_ids]);
my $count = $link_db->count($condition);
my $url = $cat_db->as_url($cat);
if ($count > 0) { $output .= qq~<a href="$CFG->{db_cgi_url}/page.cgi?p=new_scripts;ID=$id;newdate=$date;count=$count;category=$heading">$heading</a> ($count)&nbsp;~; }
}
return $output;
}

ok its working thanks =)

use in the new.html template with something like:

<%loop link_results_loop%>
<b><%date%></b> (<%count%>)<br />
<%global($date)%><br /><br />
<%endloop%>

It will link those categories with new links and send the category ID, category name, date and number of new scripts to a new page where you can use it another global or whatever.