Home : Products : Links 2.0 : Customization :

Products: Links 2.0: Customization: Re: [PerlFlunkie] How to sort by custom field?: Edit Log

Here is the list of edits for this post
Re: [PerlFlunkie] How to sort by custom field?
I think it would be easier to create an additional *.db (for example: singleperson.db)
similar to $db_url_name in nph-build.cgi ( sub build_url_index - see attachment) .

The new sub in nph-build.cgi (mod of sub build_url_index)
- ( sub build_single_person_index - for example ) -
should contain a counter which creates a different value
for each single person (existing combination : last name + first name) .
For each entry in links.db the number of persons must be proofed.

The values of the counter = The new $db_key ( $values[$db_key_pos] in sub build_url_index ) in singleperson.db.

Entries for each single person:

- The new $db_key
- last name
- first name
- birthday

and $db_key of links.sb because it could be that two persons have identic last names and first names.

Now it should be easy to sort singleperson.db by date and
create a text list or a html site using templates.

( If you need the exact code links.def, links.cfg would be useful )

Sorry for my bad english.

Code:

sub build_url_index {
# --------------------------------------------------------


my $time = time();
my @values = ();
my $count = 0;

open (DB, "<$db_file_name") or &cgierr("Kann die Datei bzw. Verzeichnis nicht öffnen: $db_file_name.\nGrund: $!");
open (URL, ">$db_url_name") or &cgierr("Kann die Datei bzw. Verzeichnis nicht öffnen: $db_url_name. Grund: $!");
if ($db_use_flock) { flock (URL, 2) or &cgierr ("Allgemeiner Fehler. Grund: $!"); }
LINE: while (<DB>) {
/^#/ and next LINE;
/^\s*$/ and next LINE;
chomp;
@values = &split_decode($_);
print URL "$values[$db_key_pos]$db_delim$values[$db_url]\n";
$count++;
}
close DB;
close URL;


open (CNT, ">$db_hits_path/index.count") or &cgierr("Kann die Datei bzw. Verzeichnis nicht öffnen: '$db_hits_path/index.count'. Grund: $!");
if ($db_use_flock) { flock (CNT, 2) or &cgierr ("Kann die Datei bzw. Verzeichnis nicht öffnen: $db_hits_path/index.count. Grund: $!"); }
print CNT $count;
close CNT;
}


.












.


Andreas

Dr.Windows








Last edited by:

SevenSpirits: Sep 1, 2008, 2:49 PM

Edit Log: