I would like to add a field to the add.cgi page that has a spot for someone to list the page that they link back to and for it to show up in the validation part of the admin panel. Suggestions on a step by step process?
Jul 13, 2004, 2:36 PM
Veteran (1352 posts)
Jul 13, 2004, 2:36 PM
Post #3 of 26
Views: 9782
Changes in links.def do not automaticaly show up in the add page, just in the admin. You would need to add the field to the add form, also to the modify form. Just look at a field that's already there, for instance the url field, since you want an url to a linked page, and copy that info. Also note that any change in the number of fields will require adding a new field space to all the links in the link.db, using a pipe |.
Leonard
aka PerlFlunkie
Leonard
aka PerlFlunkie
Jul 14, 2004, 10:55 PM
Veteran (1352 posts)
Jul 14, 2004, 10:55 PM
Post #5 of 26
Views: 9757
I'll try, I may miss something...
In links.def, add this:
Recip => [14, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp']
after this:
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
be sure to add the comma!
Then add this:
# 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 = 11; $db_mail = 13;
$db_recip = 14;
---
Next, in site_html_templates.pl, add this at the top of the file, in the globals:
css => $build_css_url,
recip => $recip,
banner => ''
(Actually, may not need this step; skip it unless you get an error saying 'unrecognized tag...')
---
Next, in your add template, add something like so:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="Recip" size="50"></td></tr>
then in add_error:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="Recip" value="<%URL%>" size="50"></td></tr>
then in add_success:
Reciprocal URL: <%Recip%>
And the same for the three modify templates.
---
In add.cgi, add this to sub send_email:
Title: $in{'Title'}
URL: $in{'URL'}
Reciprical URL: $in{'Recip'},
Category: $in{'Category'}
Description: $in{'Description'}
Contact Name: $in{'Contact Name'}
Contact Email: $in{'Contact Email'}
Similar change to make in modify.cgi.
---
The hardest part is adding the new field to all existing links (unless this a new install, in which case there's nothing to worry about). This is made much easier using the script here:
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=27938#27938
http://www.gossamer-threads.com/...cgi?post=48377#48377
---
After writing all this, while looking in my files for something else, I found this link:
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=31234#31234
Leonard
aka PerlFlunkie
In links.def, add this:
Recip => [14, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp']
after this:
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
be sure to add the comma!
Then add this:
# 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 = 11; $db_mail = 13;
$db_recip = 14;
---
Next, in site_html_templates.pl, add this at the top of the file, in the globals:
css => $build_css_url,
recip => $recip,
banner => ''
(Actually, may not need this step; skip it unless you get an error saying 'unrecognized tag...')
---
Next, in your add template, add something like so:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="Recip" size="50"></td></tr>
then in add_error:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="Recip" value="<%URL%>" size="50"></td></tr>
then in add_success:
Reciprocal URL: <%Recip%>
And the same for the three modify templates.
---
In add.cgi, add this to sub send_email:
Title: $in{'Title'}
URL: $in{'URL'}
Reciprical URL: $in{'Recip'},
Category: $in{'Category'}
Description: $in{'Description'}
Contact Name: $in{'Contact Name'}
Contact Email: $in{'Contact Email'}
Similar change to make in modify.cgi.
---
The hardest part is adding the new field to all existing links (unless this a new install, in which case there's nothing to worry about). This is made much easier using the script here:
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=27938#27938
http://www.gossamer-threads.com/...cgi?post=48377#48377
---
After writing all this, while looking in my files for something else, I found this link:
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=31234#31234
Leonard
aka PerlFlunkie
Jul 17, 2004, 11:26 AM
User (225 posts)
Jul 17, 2004, 11:26 AM
Post #6 of 26
Views: 9769
Ok I did all of this I'll try, I may miss something...
In links.def, add this:
Recip => [14, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp']
after this:
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
be sure to add the comma!
Then add this:
# 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 = 11; $db_mail = 13;
$db_recip = 14;
---
Next, in site_html_templates.pl, add this at the top of the file, in the globals:
css => $build_css_url,
recip => $recip,
banner => ''
(Actually, may not need this step; skip it unless you get an error saying 'unrecognized tag...')
---
Next, in your add template, add something like so:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="Recip" size="50"></td></tr>
then in add_error:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="Recip" value="<%URL%>" size="50"></td></tr>
then in add_success:
Reciprocal URL: <%Recip%>
And the same for the three modify templates.
---
In add.cgi, add this to sub send_email:
Title: $in{'Title'}
URL: $in{'URL'}
Reciprical URL: $in{'Recip'},
Category: $in{'Category'}
Description: $in{'Description'}
Contact Name: $in{'Contact Name'}
Contact Email: $in{'Contact Email'}
Similar change to make in modify.cgi.
and I get an error message saying
Error Message : fatal error: syntax error at /home/ldstryfe/public_html/cgi-bin/admin/links.def line 37, near "'http://' '^http|news|mailto|ftp'"
syntax error at /home/ldstryfe/public_html/cgi-bin/admin/links.def line 62, near "$db_sort_links "
Compilation failed in require at admin.cgi line 55.
Script Location : admin.cgi
Perl Version : 5.008001
In links.def, add this:
Recip => [14, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp']
after this:
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
be sure to add the comma!
Then add this:
# 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 = 11; $db_mail = 13;
$db_recip = 14;
---
Next, in site_html_templates.pl, add this at the top of the file, in the globals:
css => $build_css_url,
recip => $recip,
banner => ''
(Actually, may not need this step; skip it unless you get an error saying 'unrecognized tag...')
---
Next, in your add template, add something like so:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="Recip" size="50"></td></tr>
then in add_error:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="Recip" value="<%URL%>" size="50"></td></tr>
then in add_success:
Reciprocal URL: <%Recip%>
And the same for the three modify templates.
---
In add.cgi, add this to sub send_email:
Title: $in{'Title'}
URL: $in{'URL'}
Reciprical URL: $in{'Recip'},
Category: $in{'Category'}
Description: $in{'Description'}
Contact Name: $in{'Contact Name'}
Contact Email: $in{'Contact Email'}
Similar change to make in modify.cgi.
and I get an error message saying
Error Message : fatal error: syntax error at /home/ldstryfe/public_html/cgi-bin/admin/links.def line 37, near "'http://' '^http|news|mailto|ftp'"
syntax error at /home/ldstryfe/public_html/cgi-bin/admin/links.def line 62, near "$db_sort_links "
Compilation failed in require at admin.cgi line 55.
Script Location : admin.cgi
Perl Version : 5.008001
Jul 17, 2004, 1:10 PM
Veteran (1352 posts)
Jul 17, 2004, 1:10 PM
Post #7 of 26
Views: 9773
Did you put in the comma (for ReceiveMail)?
In links.def:
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
Recip => [14, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp']
Also, you can change the 1 to a 0 and the field will not be required. The 1 makes it required.
If that doesn't fix it, you may need to go into links.cfg, at the bottom of the file, and add this line to the Extra Paths:
$db_lib_path = $db_script_path; # PATH of library files.
$db_links_name = "$db_script_path/data/links.db"; # PATH to links database.
$db_recip = "$db_script_path/data/recip.db"; # PATH to reciprical link database.
And then create an empty file in the data directory named recip.db
And I noticed this error in my code above:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="Recip" value="<%URL%>" size="50"></td></tr>
Should be:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="recip" value="<%recip%>" size="50"></td></tr>
Actually, ALL instances of Recip need to be all lowercase: recip, except for the one in links.def, Recip => [14, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp']
And, if you have added any other mods that added fields to the links.def, then of course you need to adjust the field number accordingly, in both places in links.def. It is not important that it be number 14, just add it to the end of the list and number it in sequence.
Leonard
aka PerlFlunkie
In links.def:
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
Recip => [14, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp']
Also, you can change the 1 to a 0 and the field will not be required. The 1 makes it required.
If that doesn't fix it, you may need to go into links.cfg, at the bottom of the file, and add this line to the Extra Paths:
$db_lib_path = $db_script_path; # PATH of library files.
$db_links_name = "$db_script_path/data/links.db"; # PATH to links database.
$db_recip = "$db_script_path/data/recip.db"; # PATH to reciprical link database.
And then create an empty file in the data directory named recip.db
And I noticed this error in my code above:
Quote:
then in add_error: <tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="Recip" value="<%URL%>" size="50"></td></tr>
Should be:
<tr><td align="right" valign="top">Reciprical URL:</td>
<td><input name="recip" value="<%recip%>" size="50"></td></tr>
Actually, ALL instances of Recip need to be all lowercase: recip, except for the one in links.def, Recip => [14, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp']
And, if you have added any other mods that added fields to the links.def, then of course you need to adjust the field number accordingly, in both places in links.def. It is not important that it be number 14, just add it to the end of the list and number it in sequence.
Leonard
aka PerlFlunkie
Jul 22, 2004, 5:37 AM
Veteran / Moderator (18441 posts)
Jul 22, 2004, 5:37 AM
Post #11 of 26
Views: 9750
Hi. Looks like its down to;
I guess it should be something like;
Hope that helps.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Code:
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],I guess it should be something like;
Code:
Rating => [11, 'numer', 10, 10, 1, 0, '^\d+\.\d\d$',Hope that helps.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Jul 22, 2004, 6:33 PM
User (225 posts)
Jul 22, 2004, 6:33 PM
Post #13 of 26
Views: 9758
Found another problem. I am testing it now.
Last edited by:
LordStryfe: Jul 22, 2004, 6:35 PM
Jul 22, 2004, 9:59 PM
Veteran (1352 posts)
Jul 22, 2004, 9:59 PM
Post #17 of 26
Views: 9710
It should have this info:
ID|Title|URL|Date|Category|Description|Contact Name|Contact Email|Hits|isNew|isPopular|Rating|Votes|ReceiveMail|Recip
or,
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14
The last field (recip) can be empty, in which case you would have:
ID|Title|URL|Date|Category|Description|Contact Name|Contact Email|Hits|isNew|isPopular|Rating|Votes|ReceiveMail|
(I used the field name, not what would be in the db file.)
You may want to post the first few (3-4) entries from you link.db, then we can see what's going on.
Leonard
aka PerlFlunkie
ID|Title|URL|Date|Category|Description|Contact Name|Contact Email|Hits|isNew|isPopular|Rating|Votes|ReceiveMail|Recip
or,
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14
The last field (recip) can be empty, in which case you would have:
ID|Title|URL|Date|Category|Description|Contact Name|Contact Email|Hits|isNew|isPopular|Rating|Votes|ReceiveMail|
(I used the field name, not what would be in the db file.)
You may want to post the first few (3-4) entries from you link.db, then we can see what's going on.
Leonard
aka PerlFlunkie
Last edited by:
PerlFlunkie: Jul 22, 2004, 10:01 PM
Jul 23, 2004, 4:54 AM
User (225 posts)
Jul 23, 2004, 4:54 AM
Post #18 of 26
Views: 9715
1|Christian window stickers, license plates, tire covers and t-shirts|http://www.goodnewsgraphics.com|13-Nov-2003|Shopping/Christian_Gift_Shops|Awesome Christian window stickers, license plates, t-shirts and spare tire covers. More than 95 designs...your choice of colors and sizes!!! ``FREE 3-pack of "Assorted Fish" window stickers with your order!``"witness without speaking a word"|Ernie Johns|goodnews@goodnewsgraphics.com|56|No|No|0|0|Yes|
2|Sound Doctrine Ministries|http://sounddoctrine.org/|25-Jul-2003|Ministries|Order free items. Devoted to discipleship issues. Home of the book, "Hating For Jesus" (John 12:25 & Luke 14:25-35)|Tim Williams|twilliams@saintmail.net|1|No|No|0|0|Yes|
3|Sarah Laughing - Independent Christian music funk and groove band|http://www.sarahlaughing.com|1-Jan-2004|Music/Bands_and_Artists/Indie_Music|Sarah Laughing - Independent Christian music funk and groove band. Click here|L Hartman|sarahlaughing@earthlink.net|1|No|No|0|0|Yes|
4|Community Church|http://www.info.bw/~commchch/|23-Mar-2003|Churches/Africa/Botswana|Francistown. Cell based charismatic church.|Senior Pastors John & Angela Bacon|commchch@info.bw|9|No|No|0|0|Yes|
2|Sound Doctrine Ministries|http://sounddoctrine.org/|25-Jul-2003|Ministries|Order free items. Devoted to discipleship issues. Home of the book, "Hating For Jesus" (John 12:25 & Luke 14:25-35)|Tim Williams|twilliams@saintmail.net|1|No|No|0|0|Yes|
3|Sarah Laughing - Independent Christian music funk and groove band|http://www.sarahlaughing.com|1-Jan-2004|Music/Bands_and_Artists/Indie_Music|Sarah Laughing - Independent Christian music funk and groove band. Click here|L Hartman|sarahlaughing@earthlink.net|1|No|No|0|0|Yes|
4|Community Church|http://www.info.bw/~commchch/|23-Mar-2003|Churches/Africa/Botswana|Francistown. Cell based charismatic church.|Senior Pastors John & Angela Bacon|commchch@info.bw|9|No|No|0|0|Yes|
Jul 23, 2004, 2:12 PM
Veteran (1352 posts)
Jul 23, 2004, 2:12 PM
Post #19 of 26
Views: 9699
Well, those look OK... Did you use the script linked above to add the delimeters? Check your last few entries in the links.db, make sure they don't have an extra delimeter | in them. Or just use the admin to view the last link you added (Links/View), and see if all the data is in the right fields.
Leonard
aka PerlFlunkie
Leonard
aka PerlFlunkie