Gossamer Forum
Home : Products : Links 2.0 : Customization :

New category field not showing up

Quote Reply
New category field not showing up
Arghhh... I have gone over the code a billion times with no luck. I am attempting to add a category field and have followed the directions previously posted in the forum. I want to add a linkcolor field that I can use to change the link color per category page. Here's what I have so far - perhaps it is just something simple I am missing.

category.def 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, '', ''],
Linkcolor => [8, 'alpha', 40, 75, 0, '', '']
);
**********************************
in site_html_template.pl file:

added the line linkcolor => $linkcolor,

to the sub site_html_category {
# --------------------------------------------------------
# This rountine will build a page based for the current category.

return &load_template ( 'category.html', {

routine
*******************************************
in nph-build.cgi file:

sub build_category_pages routine,

local ($description, $related, $meta_name, $meta_keywords, $header, $footer, $linkcolor, $next, $prev);

Then in category.html template, I am using the tag <%linkcolor%>

I have added the field in my category.db file, and it is showing up and seen in the admin section when you modify a category, but it is not displaying what's in the field. I don't get an error msg that it doesn't recognize the tag - it's as if it just doesn't pull in what's supposed to be in the field.

What I am doing wrong? Unsure
Quote Reply
More info In reply to
My problem seems to be related to this post:

http://www.gossamer-threads.com/...gory%20field;#276179

I seem to be limited to 8 category fields. I removed the footer category field (wasn't using it anyway), and replaced it with information for my other field. It worked. I then added a 9th category field, and it doesn't recognize it.

Here's an example:

# 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, '', ''],
Linkcolor => [7, 'alpha', 40, 75, 0, '', ''],
Visitcolor => [8, 'alpha', 40, 75, 0, '', '']
);

<%linkcolor%> now pulls the field from the 8th spot. The <%visitcolor%> tag doesn't give me an unknown tag error, but it doesn't pull any information from the db file:

85|Mountain_West/Colorado_State|||Colorado State Rams|Colorado State Rams, CSU, message boards|colostate.html|006600|000000

I've even tried adding on a 10th field, and the last two don't work - just the first 8. Unsure

Last edited by:

Bobsie: Jan 5, 2008, 11:26 AM
Quote Reply
Re: [dawgtoons] More info In reply to
Argh... still trying to make this work. I referenced this post:

http://www.gossamer-threads.com//perl/gforum/gforum.cgi?post=142718#p142718

Quote:
If you want to add more that 7 fields to category.db follow the instructions listed on the website below and then make this VERY IMPORTANT MODIFICATION or you will drive yourself crazy(going on 18 hours straight myself): in nph_build find sub build_category_information:

change:
@values = &split_decode($_);

to:
@values = split(/\|/,$_);

http://www.webmasters-resources.com/links/category_title_mod.html


Still no luck... maybe it's a perl setting on my server??? I have no idea at this point. MadMadMadMadMadMadMad

FWIW, I am able to add fields to links, just not categories.

Last edited by:

dawgtoons: Jan 6, 2008, 7:52 PM
Quote Reply
Re: [dawgtoons] More info In reply to
The answer may be in the post you referenced, http://www.gossamer-threads.com/...?post=142687#p142687
Did you add the fields as shown here, and adjust the field range ( [2..16] ) as needed?


4. Added 9 field definitions and changed range of category array setup in sub build_category_pages

# We set up all the variables people can use in &site_html.pl.
($description, $related, $meta_name, $meta_keywords, $header, $footer, $onehotid, $onehotimg, $onehotdesc, $twohotid, $twohotimg, $twohotdesc, $threehotid, $threehotimg, $threehotdesc) = @{$category{$cat}}[2..16];




Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] More info In reply to
Yes, I tried that as well. I've tried adding a few more fields (with no luck), so here is what I have now:

Code:
# We set up all the variables people can use in &site_html.pl.
($description, $related, $meta_name, $meta_keywords, $header, $linkcolor, $visitcolor, $hovercolor) = @{$category{$cat}}[2..9];
Quote Reply
Re: [dawgtoons] New category field not showing up In reply to
Well... all of a sudden this started working... I guess I cussed at it enough. Tongue

Last edited by:

dawgtoons: Feb 9, 2008, 8:00 AM
Quote Reply
Re: [dawgtoons] New category field not showing up In reply to
FWIW, I am hitting the 13 field limit as well.
Quote Reply
Re: [dawgtoons] New category field not showing up In reply to
Perhaps adding something like links.def has would help?

# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_meta_description = 4; $db_related = 3; $db_description = 2;
$db_footer = 7; $db_header = 6; $db_meta_keywords = 5;
$db_linkcolor = 8; $db_visitcolor = 9; $db_hovercolor = 10;


(Change to match your field names...)


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] New category field not showing up In reply to
Thanks - I will try that this weekend... Smile