Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Calling additonal fields from category.db

Quote Reply
Calling additonal fields from category.db
Hello all,

I am trying to figure out how to call fields from the category.db. I already know how to add them to category.def. I am trying to call the ID field and others I have created. I am using templates so in the category.html I have tried:

<%ID%> with no luck.

Which files would I need to edit in order to make this work?

Larry
Quote Reply
Re: Calling additonal fields from category.db In reply to
Try adding the following at the top of the sub site_html_category routine:

Code:
my (%rec) = @_;

Then add the following codes in the tag definition area of this sub:

Code:
%rec,

Regards.

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Calling additonal fields from category.db In reply to
Thanks for the fast reply, Smile

I added like you said but no luck.

Do I need to add somthing like
ID => $ID anywhere?

I have been trying this all night I think. Should have went to sleep last night instead of hacking away at this!!! Smile

Larry
Quote Reply
Re: Calling additonal fields from category.db In reply to
No...

You do not need to define the separate tags from the category.def file.

The record hash does that for you...pulls the fields from the categories.db file.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Calling additonal fields from category.db In reply to
Still no luck,

I am getting unknown tag : errors now.

Here is what I have in category.def
%db_def = (
ID => [0,'numer',5,8,1,'',''],
thru
BannerAd => [11,'alpha',40,75,0,'','']

Could there be a problem because ID is a field name in link.def also?

Still scratching head over this one,
Larry

Quote Reply
Re: Calling additonal fields from category.db In reply to
Hmmm....that shouldn't happen...But you could try defining the ID tag as the following:

Code:
ID => $rec{'ID'}

Other than that...you will have to go into the sub build_category_pages and start hacking it to put the ID in the category pages...

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Calling additonal fields from category.db In reply to
Figured it out finally!!!

I had to edit the nph-build.cgi and change
This line:

# We set up all the variables people can use in &site_html.pl.
($description, $related, $meta_name, $meta_keywords, $header, $footer, $category_title) = @{$category{$cat}}[2..8];

to this

($id, $name, $description, $related, $meta_name, $meta_keywords, $header, $footer, $category_title, $subcatstyle, $isssi, $bannerad) = @{$category{$cat}}[0..11];

Also had to add
id => $id
in the sub site_html_category

Thanks AnthroRules for all your help here!!! Smile

Larry
Quote Reply
Re: Calling additonal fields from category.db In reply to
Glad you figured it out.

You're welcome.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.