Hi,
I'm thinking of adding a subroutine to make Links SQL automate the maintenance of my "Featured Site" page. Previously, I was entering sites that link back to my site in a text file -- one link per line -- which would then randomly be selected by a cgi script and included in the HTML page. When upgrading to Links SQL, I realized that my method of using the jump.cgi link was a problem, as the Links SQL import compresses the link numbering... I went through and changed them to their actual URL's for the time being.
What I would like to do is add a field to the database, isFeatured. This would default to No and could be flagged as Yes, if appropriate. A subroutine would then be added to nph-build.cgi, which would assemble the text file mentioned above. Here's where I could use some help, as I don't think my Perl/SQL skills are quite up to putting it together.
I believe the shell of the sub would look like this:
$OUT = "<a target=\"_blank\" href=\"<%db_cgi_url%>/jump.cgi?ID=<%ID%>\"><%Title%></a> <%Description%><BR><BR>";
}
$file = "/path/to/featured.txt";
open (FEATURED, $file) or die "Can't open $file Reason: $!";
print FEATURED (\%OUT);
close FEATURED;Do <%ID%>, <%Title%>, and <%Description%> need to be declared for this to work, and do quotes need to be escaped? Am I even on the right track as to how to write to the file? Also, I'm sure more needs to be done in terms of checking the isFeatured field.
Any help would be greatly appreciated in getting me started. Also, if you can think of better ways I should be approaching this, I am open to suggestions.
Thanks,
Dan
------------------
Run-Down -> Links SQL
http://run-down.com/
I'm thinking of adding a subroutine to make Links SQL automate the maintenance of my "Featured Site" page. Previously, I was entering sites that link back to my site in a text file -- one link per line -- which would then randomly be selected by a cgi script and included in the HTML page. When upgrading to Links SQL, I realized that my method of using the jump.cgi link was a problem, as the Links SQL import compresses the link numbering... I went through and changed them to their actual URL's for the time being.
What I would like to do is add a field to the database, isFeatured. This would default to No and could be flagged as Yes, if appropriate. A subroutine would then be added to nph-build.cgi, which would assemble the text file mentioned above. Here's where I could use some help, as I don't think my Perl/SQL skills are quite up to putting it together.
I believe the shell of the sub would look like this:
Code:
if ($isFeatured == "Yes") { $OUT = "<a target=\"_blank\" href=\"<%db_cgi_url%>/jump.cgi?ID=<%ID%>\"><%Title%></a> <%Description%><BR><BR>";
}
$file = "/path/to/featured.txt";
open (FEATURED, $file) or die "Can't open $file Reason: $!";
print FEATURED (\%OUT);
close FEATURED;
Any help would be greatly appreciated in getting me started. Also, if you can think of better ways I should be approaching this, I am open to suggestions.
Thanks,
Dan
------------------
Run-Down -> Links SQL
http://run-down.com/