Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Second links database

Quote Reply
Second links database
I had this wild idea to move the information of one of my links 2 fields to a second database - it is just a text field just used for displaying data.

In my links 2 field called Reason, I added the name of a text file - specifically 1008.txt

I created the file 1008.txt with the desired data and uploaded it to the appropriate folder.

I tried using <%include Reason%> in my detailed.html page. Received "could not find file Reason" error

Then I tried the following on my detailed pages

Code:
sub site_html_detailed {
# --------------------------------------------------------
# This routine will build a single page per link. It's only
# really useful if you have a long review for each link --
# or more information then can be displayed in a summary.
#
my %rec = @_;
my $clean_title = $rec{'Title'};
$clean_title =~ s,',\\',g;


my (@values, $id_counter, $rates_b);
$file_name = "$db_script_path/data/desc/$rec{'Reason'}";
open (DB, "<$file_name") or &cgierr("unable to open database: $file_name. Reason: $!");
LINE: while (<DB> ) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$id_counter = $values[0];
if ($rec{'ID'} eq $id_counter) {
$rates_b = $values[1];
}
}
close DB;



return &load_template ('detailed.html', {
total => $total,
grand_total => $grand_total,
title_linked => $title_linked,
clean_title => $clean_title,
title_unlinked => $title_unlinked,
hitsday => $hitsday,
rates_b => $rates_b,
%rec,
%globals
} );
}


PS: Don't be confused by the variable names I used above. I was just being random.


I changed the 1008.txt file to contain the ID as well as the data in the format of ID|Data

then in the detailed.html page I just added <%rates_b%>. and it printed it out the correct data.

I'm not sure if it works on multiple data. but I guess it should.

I know that if I move the data out of links.db that it is not directly searchable.

but any other thoughts?


.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."

Last edited by:

esm: Feb 19, 2003, 6:38 AM