Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Re: Featured Site mod help

Quote Reply
Re: Featured Site mod help In reply to
I got it to work!

The text file source code was not formatted correctly before -- it was all on one line. The HTML output (page.cgi) was ok, but that didn't help the random picker...

I made a few changes, most significantly being turning off "compress white space" in Links.pm. I think that was the key aspect. Is there any way to turn it off for select routines, or is it an all or nothing proposition?

The other thing I changed was wrapping each link in <p> </p> tags instead of <BR><BR> at the end. This seemed to solve the problem, but after changing a few things, I think it might have been a browser cache thing (I thought I refreshed, but maybe not) while testing the compress white space around the same time...

I also added in a few things to the subroutine in nph-build.cgi to output build results like the other subs. Here's the output text file:

http://run-down.com/featured_test.txt

Just a couple hundred more links to set isFeatured to Yes... Here's the page it will be pulled into when it is finished:

http://run-down.com/featured.shtml

And lastly, here's the full subroutine in nph-build.cgi (for anyone following along that wants to do a similar thing):
Code:
sub is_featured {
# --------------------------------------------------------
# Creates a featured sites page.
#
my ($s, $f, $e, $file, $total, $link, $sth, $featured_r, $id, $title, $url, $description);

$file = 'featured_test.txt';

$USE_HTML ?
print "Building <a href='$LINKS{build_root_url}/$file' target='_blank'>Featured</a> ... \n" :
print "Building Featured Page ... \n";
$s = time();

$sth = $LINKDB->prepare (qq!
SELECT *
FROM Links
WHERE Links.isFeatured = 'Yes'
ORDER BY $LINKS{build_sort_order_cool}
!);
$sth->execute();

# Create the HTML for the individual links.
$total = 0;
$featured_r = '';
while ($link = $sth->fetchrow_hashref) {
$total++;
$id = $link->{'ID'};
$title = $link->{'Title'};
$url = $link->{'URL'};
$description = $link->{'Description'};
$featured_r .= qq~<p><a target="_blank" href="$LINKS{db_cgi_url}/jump.cgi?ID=${$link}{'ID'}">${$link}{'Title'}</a> ${$link}{'Description'}</p>\n~;
}

open (FEATURED, ">$LINKS{build_root_path}/$file") or die ("unable to open featured page: $LINKS{build_root_path}/$file . Reason: $!");
print "\tFeatured Links: $total\n";
print FEATURED &site_featured_template ( { featured_r => $featured_r } );
close(FEATURED);
# All done.
$f = time();
$e = $f - $s;
print "Done ($e s)\n\n";

}
Thanks again for all the help getting this to work! Smile It took a while, and I still have a lot of links to change, but long-term it will be a HUGE time saver.

Dan


[This message has been edited by Dan Kaplan (edited March 17, 2000).]
Subject Author Views Date
Thread Featured Site mod help Dan Kaplan 8016 Mar 13, 2000, 11:52 AM
Post Re: Featured Site mod help
phoule 7851 Mar 13, 2000, 1:38 PM
Post Re: Featured Site mod help
Dan Kaplan 7850 Mar 13, 2000, 4:39 PM
Post Re: Featured Site mod help
pugdog 7853 Mar 13, 2000, 5:26 PM
Post Re: Featured Site mod help
phoule 7848 Mar 13, 2000, 5:40 PM
Post Re: Featured Site mod help
Dan Kaplan 7854 Mar 13, 2000, 6:57 PM
Post Re: Featured Site mod help
pugdog 7890 Mar 13, 2000, 7:22 PM
Post Re: Featured Site mod help
phoule 7844 Mar 13, 2000, 7:34 PM
Post Re: Featured Site mod help
Dan Kaplan 7861 Mar 13, 2000, 7:52 PM
Post Re: Featured Site mod help
phoule 7845 Mar 13, 2000, 8:27 PM
Post Re: Featured Site mod help
phoule 7871 Mar 14, 2000, 3:39 AM
Post Re: Featured Site mod help
Dan Kaplan 7853 Mar 14, 2000, 3:49 AM
Post Re: Featured Site mod help
phoule 7850 Mar 14, 2000, 4:49 AM
Post Re: Featured Site mod help
Dan Kaplan 7847 Mar 14, 2000, 6:33 AM
Post Re: Featured Site mod help
Dan Kaplan 7856 Mar 14, 2000, 8:43 AM
Post Re: Featured Site mod help
Dan Kaplan 7850 Mar 14, 2000, 9:08 AM
Post Re: Featured Site mod help
phoule 7846 Mar 15, 2000, 3:41 AM
Post Re: Featured Site mod help
Dan Kaplan 7852 Mar 15, 2000, 7:19 AM
Post Re: Featured Site mod help
phoule 7852 Mar 15, 2000, 8:18 AM
Post Re: Featured Site mod help
Dan Kaplan 7862 Mar 15, 2000, 8:18 PM
Post Re: Featured Site mod help
Dan Kaplan 7853 Mar 16, 2000, 7:37 PM
Post Re: Featured Site mod help
pugdog 7855 Mar 16, 2000, 8:54 PM
Post Re: Featured Site mod help
Dan Kaplan 7861 Mar 16, 2000, 9:05 PM
Post Re: Featured Site mod help
Dan Kaplan 7860 Mar 17, 2000, 8:04 AM
Post Re: Featured Site mod help
pugdog 7840 Mar 17, 2000, 8:34 AM
Post Re: Featured Site mod help
pugdog 1367 Mar 17, 2000, 6:21 PM
Post Re: Featured Site mod help
Dan Kaplan 1367 Mar 18, 2000, 7:14 PM