I can't figure out what to do in order to get my headlines.cgi script to sort in the order I want. I have used the traditional "&sb=2&so=ascend" but that doesn't do anything to change it. It appears that it is sorting in reverse ID order. I even tried "&sb=$data[2]" Any idea how I can do this?
Here is what I have:
#!/usr/local/bin/perl
### change to match your server path
### Display latest headlines ####
#### modify the path and filename of your db
$db_file_name = "/mnt/web/guide/merginet/newsite/scripts/specials/specials.db";
$db_script_url = "http://www.merginet.com/scripts/db.cgi";
open (DB, "<$db_file_name") or &cgierr("error in modify_records. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
my @lines = <DB>; # Slurp the database into @lines..
close DB;
my $LASTX = 9; # How many headlines do you want?
for ($i=$#lines; $i>=($#lines - $LASTX); $i--) {
chomp $lines[$i];
@data = split(/\|/,$lines[$i]);
$latest .= qq|<img src="http://www.merginet.com/newsite/images/blue_arrow_nav.gif" alt="" width="7" height="7" border="0"> <A HREF="$db_script_url?db=specials&uid=default&ID=$data[0]&sb=2&so=ascend&view_records=1"><font face=verdana,ariel,helvetica size=1 color="#FFFFFF">$data[2]</font></A><br>|;
#$data[0] is record ID, $data[2] is title in my DB
}
print $latest;
1;
####### end display latest headlines #######
The include can be found in our new site layout here:
http://www.merginet.com/newsite/index.shtml
See Blue Tag Specials in the right side column.
Here is where the page is that will list all of the items:
http://www.merginet.com/...2&view_records=1
Thanks in advance for any help.
Richard Bilger
RBilger@MERGINET.com
MERGINET.com: Emergency Responders Web Site
http://www.merginet.com
Here is what I have:
#!/usr/local/bin/perl
### change to match your server path
### Display latest headlines ####
#### modify the path and filename of your db
$db_file_name = "/mnt/web/guide/merginet/newsite/scripts/specials/specials.db";
$db_script_url = "http://www.merginet.com/scripts/db.cgi";
open (DB, "<$db_file_name") or &cgierr("error in modify_records. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
my @lines = <DB>; # Slurp the database into @lines..
close DB;
my $LASTX = 9; # How many headlines do you want?
for ($i=$#lines; $i>=($#lines - $LASTX); $i--) {
chomp $lines[$i];
@data = split(/\|/,$lines[$i]);
$latest .= qq|<img src="http://www.merginet.com/newsite/images/blue_arrow_nav.gif" alt="" width="7" height="7" border="0"> <A HREF="$db_script_url?db=specials&uid=default&ID=$data[0]&sb=2&so=ascend&view_records=1"><font face=verdana,ariel,helvetica size=1 color="#FFFFFF">$data[2]</font></A><br>|;
#$data[0] is record ID, $data[2] is title in my DB
}
print $latest;
1;
####### end display latest headlines #######
The include can be found in our new site layout here:
http://www.merginet.com/newsite/index.shtml
See Blue Tag Specials in the right side column.
Here is where the page is that will list all of the items:
http://www.merginet.com/...2&view_records=1
Thanks in advance for any help.
Richard Bilger
RBilger@MERGINET.com
MERGINET.com: Emergency Responders Web Site
http://www.merginet.com