Gossamer Forum
Home : Products : DBMan : Customization :

sub html_record and $rec2{fieldname}

Quote Reply
sub html_record and $rec2{fieldname}
I am using a relational database setup.

My sub html_record_long does display $rec2{fieldname} --> see code below.
My sub html_record will not display $rec2{fieldname} --> see code below.

When I try to use the same code from sub html_record_long in sub html_record I have problems; the $rec2{fieldname} displays but the actual item record gets corrupted.

Can anyone help me out with this switch?

Thank you.


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.
# This is the "short display" -- the list of records that are returned
# from a search.



my (%rec) = @_;
$rec{$db_key} =~ s/<.?B>//g;



# create link to full display
$record_number = ((($nh - 1) * $db_max_hits) + $i);

$long_url = $ENV{'QUERY_STRING'};
$long_url =~ s/\&nh=\d+//;
$long_url =~ s/\&mh=\d+//;

$long_url = "$db_script_url?$long_url&nh=$record_number&mh=1";

print "<TD HEIGHT=10>"; # do not remove this! It is necessary to make the records display properly

# <-- START of short display formatting -- >


print qq|<a href="$long_url"><font size=4>$rec{'RecipeName'}</font></a> (<$font>a $rec{'RecipeCategory'} usually served at $rec{'MealTime'} and prepared $rec{'UsedWhen'}</font>)
|;


# <-- End of short display formatting -- >

print "</TD>"; # do not remove this! It is necessary to make the records display properly


}




sub html_record_long {
# --------------------------------------------------------
# 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.
$rec{$db_key} =~ s/<.?B>//g;
&switch_to_user;
$rec{'UserID'} =~ s/<\/?B>//g;
%rec2 = &get_record($rec{'UserID'});
&switch_to_item;
($db_auto_generate and print &build_html_record(%rec) and return);

Quote Reply
Re: [mars2] sub html_record and $rec2{fieldname} In reply to
I'm going to need to see the script in action.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] sub html_record and $rec2{fieldname} In reply to
JPD,
Thanks once again.

www.marscafe.com/cgi-bin/dbman/recipes/db.cgi

It is the same the username and password I messaged you last week.

Currently I am not trying to run the switch in sub html_record. Would you like me insert the code?

chef mars


Quote Reply
Re: [mars2] sub html_record and $rec2{fieldname} In reply to
I had tried it before, but I guess I mistyped the password. :)

Yes, please insert the code.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.