Gossamer Forum
Home : Products : Links 2.0 : Customization :

Hard-coded Categories in 2.0

Quote Reply
Hard-coded Categories in 2.0
Hi,

If I am not using templates, how do I implement hard-coded categories into 2.0? Is there a special tag for it? Any help would be appreciated!
Quote Reply
Re: Hard-coded Categories in 2.0 In reply to
It's an option in links.cfg

--mark
Quote Reply
Re: Hard-coded Categories in 2.0 In reply to
I know, but what do I put in the site_html.pl?
Quote Reply
Re: Hard-coded Categories in 2.0 In reply to
Nope, there is no change in site_html.pl (or in templates for that matter) It will be called by the $category variable, which is already present in the code.

Phoenix
Quote Reply
Re: Hard-coded Categories in 2.0 In reply to
In the site_Html.pl under Add Resources,

replacing:
~; $db_select_fields{'Category'} = join (",", &category_list); print &build_select_field ("Category", "$in{'Cat'}"); print qq~

with:
$category

doesnt work. What is the correct code/tag?
Quote Reply
Re: Hard-coded Categories in 2.0 In reply to
Cannon,

The beginning of the ADD section of site_html.pl should look like this:
Code:
sub site_html_add_form {
# --------------------------------------------------------
# This routine determines how the add form page will look like.
#
my $category = shift;
$category ?
($category = qq~$category <input type=hidden name="Category" value="$category">~) :
($category = &build_select_field ("Category", "$in{'Category'}"));
That is the default configuration when you download the script.

If you set the single category option to 1 in links.cfg, that code will produce a hard-coded category. If you set single category to 0 in links.cfg, that same script will produce a select field of all your categories. It came ready for hard-coded categories out of the box. The ONLY thing you had to change was the option in links.cfg. There is nothing to change in site_html.pl to make this happen. It's built in.

Phoenix

[This message has been edited by phoenix (edited April 10, 1999).]