Gossamer Forum
Home : Products : Links 2.0 : Customization :

Links.def

Quote Reply
Links.def
Hi,
I have added some thing to my links.def. But now I can't use Ratings, Votes an RecieveMail.
This is my top of links.def now:
Code:
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 999, 1, '', ''],
URL => [2, 'alpha', 40, 999, 1, 'http://', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', '60x5', 100000, 0, '', ''],
'Contact Name' => [6, 'alpha', 40, 75, 1, 'site.com', ''],
'Contact Email' => [7, 'alpha', 40, 75, 1, 'info@mysite', '.+@.+\..+'],
Hits => [8, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [9, 'alpha', 0, 5, 0, 'Yes', ''],
isPopular => [10, 'alpha', 0, 5, 0, 'No', ''],
Website => [11, 'alpha', 40, 250, 1, 'http://www.mysite.com', ''],
Webtitle => [12, 'alpha', 40, 999, 1, 'mysite.com', ''],
Type => [13, 'alpha', 20, 500, 1, '', '']
);
And when i add this to it...
Code:
Rating => [14, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [15, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [16, 'alpha', 10, 10, 1, 'Yes', 'No|Yes']
...I'll get an error. What do i have to change so i can use these 3 to.
Greetings,Smile
Paul
DP - Double P, thats me.

Last edited by:

PPeelen: Nov 27, 2001, 2:59 PM
Quote Reply
Re: [PPeelen] Links.def In reply to
Add the custom fields on the end, not in the middle.
Quote Reply
Re: [PaulW] Links.def In reply to
OR go to the section below the the def hash that has variabls like $db_hits and so on and make sure those variables match up with it's field position.

--Philip
Links 2.0 moderator
Quote Reply
Re: [ThatPerson1024] Links.def In reply to
custom fields is where this 'http://www.mysite.com' is. and, the i've changed
Code:
$db_votes = 12; $db_rating = 11; $db_mail = 13;
to
Code:
$db_votes = 15; $db_rating = 14; $db_mail = 16;
And that didn't work.
Paul, can you make an little example for me.
Greeting,
Paul Peelen
DP - Double P, thats me.
Quote Reply
Re: [PPeelen] Links.def In reply to
This is my links.def, i don't know if it's useful that you have this:
Code:
# << Copyright notice.
# Database Definition: LINKS
# --------------------------------------------------------
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 999, 1, '', ''],
URL => [2, 'alpha', 40, 999, 1, 'http://', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', '60x5', 100000, 0, '', ''],
'Contact Name' => [6, 'alpha', 40, 75, 1, 'site.com', ''],
'Contact Email' => [7, 'alpha', 40, 75, 1, 'info@site.com', '.+@.+\..+'],
Hits => [8, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [9, 'alpha', 0, 5, 0, 'Yes', ''],
isPopular => [10, 'alpha', 0, 5, 0, 'No', ''],
Website => [11, 'alpha', 40, 250, 1, 'http://www.site.com', ''],
Webtitle => [12, 'alpha', 40, 999, 1, 'site.com', ''],
Type => [13, 'alpha', 20, 500, 1, '', '']
);

# Database file to use -- defined in links.cfg.
$db_file_name = $db_links_name;
# Counter file to use -- defined in links.cfg.
$db_id_file_name = $db_links_id_file_name;
# The column name for the database key.
$db_key = 'ID';
# Database delimeter.
$db_delim = '|';
# Title used in admin output.
$html_title = 'Links Database';
$html_object = 'Link';

# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 8; $db_isnew = 9; $db_ispop = 10;
$db_contact_name = 6; $db_contact_email = 7; $db_title = 1;
$db_votes = 12; $db_rating = 14; $db_mail = 13;

# Field number to sort links by:
$db_sort_links = 1;

# Field names you want to allow visitors to search on:
@search_fields = (1,2,5);

# System defaults. When adding new links or modifying links, these fields
# can not be overwritten by a user.
%add_system_fields = (
isNew => 'No',
isPopular => 'No',
Hits => '0',
Rating => 0,
Votes => 0,
ReceiveMail => 'Yes'
);

# Hash of column names to possible options. If you want to use a select form
# field, you can use &build_select_field in your HTML page. This routine will
# make a <SELECT> input tag using the following values:
%db_select_fields = (
isNew => 'Yes,No',
isPopular => 'Yes,No',
ReceiveMail => 'Yes,No'
);

# Hash of column names to radio values. If you use &build_radio_field, it will
# make a <INPUT TYPE="RADIO"> tag for you using the options specified in the hash.
%db_radio_fields = ( );

# Maximum number of hits returned in a search. Can be overridden in the search
# options.
$db_max_hits = 10;

# Use the built in key tracker.
$db_key_track = 1;

# ===========================================================================
# Build up some variables from your definitions. Internal use only.
@db_cols = ();
foreach (sort { $db_def{$a}[0] <=> $db_def{$b}[0] } keys %db_def) {
push (@db_cols, $_);
$db_sort{$_} = $db_def{$_}[1];
$db_form_len{$_} = $db_def{$_}[2];
$db_lengths{$_} = $db_def{$_}[3];
$db_not_null{$_} = $db_def{$_}[4];
$db_defaults{$_} = $db_def{$_}[5];
$db_valid_types{$_} = $db_def{$_}[6];
($_ eq $db_key) and $db_key_pos = $db_def{$_}[0];
}

1;
DP - Double P, thats me.

Last edited by:

PPeelen: Nov 28, 2001, 7:00 AM
Quote Reply
Re: [PPeelen] Links.def In reply to
When you tried to add those other fields, you did add a comma to the end of this line right
Type => [13, 'alpha', 20, 500, 1, '', ''],
?
Lavon Russell
LookHard Mods
lavon@lh.links247.net
Quote Reply
Re: [Bmxer] Links.def In reply to
no, I didn't. but it worked.
DP - Double P, thats me.
Quote Reply
Re: [PPeelen] Links.def In reply to
I've added that , now to. But, still no results.
DP - Double P, thats me.