Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Problem with New Field in Links.def

Quote Reply
Problem with New Field in Links.def
I am having a problem with a field showing up in templates.

I have added a new field called AwardDate in my links.def file:

Code:
AwardDate => [27, 'alpha', 15, 15, 0, '', '']

BTW: This is not an auto-generated value and it is a mixture of alpha and numerical characters. I tried both alpha and numer.

Then I added it in one of my template files:

<%AwardDate%>

I get the Unknown Tag: AwardDate error.

Is there something else that I need to do make this variable appear in the template file??

Thanks in advance.

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Problem with New Field in Links.def In reply to
Some ideas from a non-expert ...

1. Define the field in the list with field numbers in links.def

2. Add
%rec,
in the relevant template definition in the site_html_templates.pl (for example, just before %globals)

John
Quote Reply
Re: Problem with New Field in Links.def In reply to
Ah...Yea...I already did the first suggestion. The second suggestion is mute because as I have read in the LINKS Modification Forum, you do not need to create global variables for fields, such as the one I am referring to.

I did try that, however, and it did not work.

Thanks for your suggestion though. I really appreciate it.

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Problem with New Field in Links.def In reply to
You do not need to add it to the %rec hash. If you try to, it erases the one that is already there. The %rec hash will contain all the fields for that record already. Just try using the <%AwardDate%> in the link.html file without making any modifications for it anywhere in site_html_templates.pl. If it is punctuated correctly, it should work.

By the way, if this is a date field that displays dates in a format similar to other Links date fields (such as Date and DateAdded in the form dd-mmm-yyyy), then the field type whould be 'date' not alpha.
Quote Reply
Re: Problem with New Field in Links.def In reply to
Thanks for the response, Bobsie. I also tried just adding <%AwardDate%> to my award.html file (modified file used for the Editor's Pick Mod). It is not in the link.html where I want the field to show up. Sorry for the confusion.

The format of the field is set to alpha because it does not use formats in the get_date sub-routine of the links.cfg file. Also, it does need to be an auto-generated field like a typical date field.

And it still does not work.

This is really puzzling.

Thanks again for your input.

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Problem with New Field in Links.def In reply to
Please post the site_html_template.pl subroutine you are using to load the award.html template. Also, post the code that calls that subroutine (I assume it would be in nph-build.cgi?). Probably best to do this in the Modifications Forum since it fits there better. Thanks.
Quote Reply
Re: Problem with New Field in Links.def In reply to
 
Quote:
you do not need to create global variables for fields, such as the one I am referring to.

None of the fields in links.def are global. They can only be used in templates where the %rec hash is passed to the load_template subroutine. If %rec hash is not passed, you cannot use the <%field_name%> in the template.

If your template is one that needs to use links.def fields, then you have to provide some way of getting the %rec hash into the site_html_templates.pl subroutine that loads the template.
Quote Reply
Re: Problem with New Field in Links.def In reply to
Thanks, Bobsie. I guess I was confused with your comments posted in the LINKS Modification Forum regarding the "AddDate" Thread that is related to my problem.

I did add the AwardDate in the %rec hash of the site_html_links sub-routine and the field still does not show up. I do not know what I am doing wrong.

I added the following codes to the %rec hash:

Code:
AwardDate => $AwardDate,

Still not showing up.

Hmm....

But thanks for your input. I appreciate it.

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us