Gossamer Forum
Home : Products : DBMan : Customization :

Display only one Field

Quote Reply
Display only one Field
Hello,

Could someone help me with this - I have the What's New mod working very welll - what I would like when someone clicks on this (or i call it via SSI) is for ONLY ONE field to be shown - I would like all other recalls of records to be normal via searches - showing all fields.

It seems that I would need a new sub routine in the html.pl and a line in the db.cgi - but I do not know where to start.

Any help would be greatly appreciated,

Jim
Quote Reply
Re: [jogrady] Display only one Field In reply to
1. In html.pl in html_record, before print qq| type

if ($in{'onefield'} {
print qq| $rec{'field'} |; }
else {


2. add a } at the end of html_record

3. In the url you use for your ssi, use &onefield=1 as part of the url.
Quote Reply
Re: [sigrid] Display only one Field In reply to
Thanks very much for your response - I tried adding what you suggested but only get error message from DBMAN using any link or function -

Pasted below is what I added in html_record - could there be something else to add? thanks again for your help, Jim

sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.

my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';
if ($in{'onefield'} {
print qq|
$rec{'URL'} |; }
else {
print qq|
<TABLE WIDTH="475" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>ID:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'ID'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Predictor:</FONT></TD>
<TD>&nbsp;<$font>$rec{'Title'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Prediction:</FONT></TD>
<TD>&nbsp;<$font>$rec{'URL'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Category:</FONT></TD>
<TD>&nbsp;<$font>$rec{'Type'}</Font></TD></TR>


<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Date Made:</FONT></TD>
<TD>&nbsp;<$font>$rec{'Date'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>D-Day:</FONT></TD>
<TD>&nbsp;<$font>$rec{'Category'}</Font></TD></TR>
</TABLE>
|;
}
}
Quote Reply
Re: [jogrady] Display only one Field In reply to
Oops! So sorry- it looks like I didn't close the parentheses. Try changing

if ($in{'onefield'}

to

if ($in{'onefield'})

By the way, if you want only the record to be called up, without the footers and headers, etc. in a page, you can also surround all the html you don't want to display in your ssi page with

unless ($in{'onefield'})

{

print qq| html you don't want to display if onefield is on |;

}
Quote Reply
Re: [sigrid] Display only one Field In reply to
Thanks! Works like a charm. - I appreciate your help and your last suggestion,



Jim