Gossamer Forum
Quote Reply
Categories
I have trouble with categories when i try to add a page .

This is what i get :
" Category: error building select field: no select fields specified in config for field 'Category'! "
I am sure i have created some categories .
Thanks .
Quote Reply
Re: Categories In reply to
What codes are you using for the select field in the sub site_html_add_form routine in the site_html_templates.pl file? You have to also define the <%Category%> tag in that same sub-routine.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Categories In reply to
This is whats written inside .

sub site_html_add_form {
# --------------------------------------------------------
# This routine determines how the add form page will look like.
#
&html_print_headers;

my $category = shift;
$category ?
($category = qq~$category <input type=hidden name="Category" value="$category">~) :
($category = &build_select_field ("Category", "$in{'Category'}"));

print &load_template ('add.html', {
Category => $category,
%globals
});
}


Quote Reply
Re: Categories In reply to
Your codes are wrong for the $category variable...

You have to use the following:

Code:
my $category = shift;
my $clean_category = &build_clean($category);
$category ?
($category = qq~$clean_category <input type=hidden name="Category" value
="$category">~) :
($category = &build_select_field ("Category", "$in{'Category'}"));

You are missing the following codes:

Code:
my $clean_category = &build_clean($category);

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Categories In reply to
What tag are you using in your add.html file?

Also, have you changed the name of your Category field in your category.def file per chance?

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Categories In reply to
I have changed the code and nothing happened .
Quote Reply
Re: Categories In reply to
This is inside add.html

<p><font size="2" face="Verdana">|
<a class="menulink" href="<%build_root_url%>">Home</a> |
<a class="menulink" href="<%db_cgi_url%>/add.cgi">Add Site</a> |
<a class="menulink" href="<%db_cgi_url%>/modify.cgi">Modify Site</a> |
<a class="menulink" href="<%build_root_url%>/New">What's New</a> |
<a class="menulink" href="<%build_root_url%>/Cool"> Cool</a> |
<a class="menulink" href="<%build_root_url%>/Ratings">Top Rated</a> |
<a class="menulink" href="<%db_cgi_url%>/subscribe.cgi">Email List</a> |
<a class="menulink" href="<%db_cgi_url%>/jump.cgi?ID=random">Random Link</a> |
<a class="menulink" href="<%db_cgi_url%>/search.cgi">Search</a> |</font></p>

<form action="<%db_cgi_url%>/add.cgi" method="POST">
<p><font size="2" face="Verdana">Please fill out the form completely, and we'll add your resource as soon as possible.</font></p>
<div class="margin">
<table border ="0" cellspacing="0" cellpadding="0">
<tr><td align="right" valign="top"><font size="2" face="Verdana">Title:</font></td>
<td><font size="2" face="Verdana"><input name="Title" size="48"></font></td></tr>
<tr><td align="right" valign="top"><font size="2" face="Verdana">URL:</font></td>
<td><font size="2" face="Verdana"><input name="URL" size="48"></font></td></tr>
<tr><td align="right" valign="top"><font size="2" face="Verdana">Category:</font></td>
<td><font size="2" face="Verdana"><%Category%></font></td></tr>
<tr><td align="right" valign="top"><font size="2" face="Verdana">Description:</font></td>
<td><font size="2" face="Verdana"><textarea wrap="virtual" name="Description" value="" rows="3" cols="42"></textarea></font></td></tr>
<tr><td align="right" valign="top"><font size="2" face="Verdana">Contact Name:</font></td>
<td><font size="2" face="Verdana"><input name="Contact Name" value="" size="48"></font></td></tr>
<tr><td align="right" valign="top"><font size="2" face="Verdana">Contact Email:</font></td>
<td><font size="2" face="Verdana"><input name="Contact Email" value="" size="48"></font></td></tr>
<tr><td></td><td><font size="2" face="Verdana"><input type="SUBMIT" value="Add Site" style="font-family: Verdana; font-size: 8pt; color: #000000; background-color: #FFFFFF"></font></td></tr>
</table>
</div>
</form>

<form action="<%db_cgi_url%>/search.cgi" method="GET">
<h2><font size="2" face="Verdana">Search</font></h2>
<div class="margin">

I have the same problem on modify.cgi , my site is being hosted on a cobalt raq but everything else works fine .
Could you check this for me

http://www.crosurf.net/abc/

Thanks .
Quote Reply
Re: Categories In reply to
And the name of your Category field is Name in the category.def file? And also the name of your Category field is Category in the links.def file?

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums


[This message has been edited by AnthroRules (edited March 03, 2000).]

[This message has been edited by AnthroRules (edited March 03, 2000).]
Quote Reply
Re: Categories In reply to
# Database Definition: CATEGORIES
# --------------------------------------------------------
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 75, 1, '', '^[\w\d/_-]+$'],
Description => [2, 'alpha', '40x3', 500, 0, '', ''],
Related => [3, 'alpha', 0, 255, 0, '', ''],
'Meta Description' => [4, 'alpha', 40, 75, 0, '', ''],
'Meta Keywords' => [5, 'alpha', 40, 75, 0, '', ''],
Header => [6, 'alpha', 40, 75, 0, '', ''],
Footer => [7, 'alpha', 40, 75, 0, '', '']
);

# Database file to use -- defined in links.cfg.
$db_file_name = $db_category_name;
# Counter file to use -- defined in links.cfg.
$db_id_file_name = $db_category_id_file_name;
# The column name for the database key. MUST be the first column in the database.
$db_key = 'ID';
# Database delimeter.
$db_delim = '|';
# Title.
$html_title = 'Category Database';
$html_object = 'Category';

# 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 = ( );

# 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 = '25';

# 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;

Quote Reply
Re: Categories In reply to
See my above edited Reply...I meant to say links.def file rather than category.def file.

Sorry for the confusion.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Categories In reply to
Please save your site_html_templates.pl file as a text file, and upload it to a publicly accessible directory in your web server (NOT FTP SERVER), and then post the URL to the text file, SO that we can see the exact codes you are using...The problem has to be with the way you are defining the Category tag in your sub site_html_add_form routine.

Because with the codes I provided in my second Reply DO WORK and you are probably not using the complete codes I gave you!!!!!

Thank you,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Categories In reply to
# Database Definition: LINKS
# --------------------------------------------------------
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
URL => [2, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', '40x3', 500, 0, '', ''],
'Contact Name' => [6, 'alpha', 40, 75, 1, '', ''],
'Contact Email' => [7, 'alpha', 40, 75, 1, '', '.+@.+\..+'],
Hits => [8, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [9, 'alpha', 0, 5, 0, 'No', ''],
isPopular => [10, 'alpha', 0, 5, 0, 'No', ''],
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [12, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes']
);

# 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 = 11; $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;
Quote Reply
Re: Categories In reply to
Please try this one
http://www.crosurf.net/site_html_templates.txt

or

http://www.lemaxc.hr/site_html_templates.txt

Thanks .
Quote Reply
Re: Categories In reply to
Hello,
I have exactly this Problem also!

Bye Ralf

------------------
Quote Reply
Re: Categories In reply to
I have wrote the file in:

http://www.guestrow.net/site_html_templates.txt

So lang..and Thanks for your Help!!

Bye Ralf

------------------
Quote Reply
Re: Categories In reply to
wreki,

You need to have the following in the tag definition section of the sub site_html_add_failure LIKE you have it in the sub site_html_add_form:

Code:
Category => $category,

And you have to use the same codes I provided in this Topic earlier for the following modify sub-routines:

sub site_html_modify_form
sub site_html_modify_failure

Ralf,

Exact same advice as I gave wreki.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Categories In reply to
Can you please mail me your file :" site_html_templates.pl"
Thanks .

wreki@yahoo.com
Quote Reply
Re: Categories In reply to
Nope.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums