Gossamer Forum
Home : Products : DBMan : Customization :

Re: sorting radio fields contd.

Quote Reply
Re: sorting radio fields contd. In reply to
In Reply To:
I'm having a hard time picturing this.
The code looks like this now:
my (%rec) = @_;
($db_auto_generate and print &build_html_record(%rec) and return);
#do I really need this line?

if ($rec{'category'} ne $prev_cat) {
$prev_cat = $rec{'category'};
print qq|<h2>|;
eval "html_record_$rec{'category'}_title(%rec)";
print qq|</h2><ul>|;
}
print qq|<li>|;
eval "html_record_$rec{'category'}(%rec)";
&html_record_end(%rec);
print qq|</ul>|;
}

If the record is the first one of its category, the sub prints the heading plus <ul>. If not, it doesn't.
In both cases, the sub then prints the search results (the </li>-tag is contained in sub html_record_end).
As it stands now, the sub then also prints </ul>. If there's only one record for category "article", this is just as well. If there's a second record, the sub will, without printing the heading (that contains the <ul>-tag), still print a </ul> at the end.
I know that this is stupid, but don't know what to change. I suppose some code that checks whether the next record has the same value in $rec{'category'} as the current one would be needed at the very end: If so, don't close the list; if not, close it.
Or maybe a loop in the beginning: If this is the first search result, print heading. If it isn't, and if ($rec{'category'} ne $prev_cat), print </ul> plus the heading.



kellner
Subject Author Views Date
Thread sorting radio fields contd. kellner 7331 Jul 21, 2000, 9:16 AM
Thread Re: sorting radio fields contd.
LoisC 7223 Jul 21, 2000, 10:05 AM
Thread Re: sorting radio fields contd.
kellner 7180 Jul 23, 2000, 12:59 PM
Thread Re: sorting radio fields contd.
JPDeni 7157 Jul 25, 2000, 12:08 AM
Thread Re: sorting radio fields contd.
kellner 7152 Jul 26, 2000, 4:39 AM
Thread Re: sorting radio fields contd.
JPDeni 7146 Jul 26, 2000, 4:08 PM
Thread Re: sorting radio fields contd.
kellner 7143 Jul 26, 2000, 5:38 PM
Thread Re: sorting radio fields contd.
JPDeni 7130 Jul 26, 2000, 6:03 PM
Thread Re: sorting radio fields contd.
kellner 7145 Jul 27, 2000, 8:09 AM
Thread Re: sorting radio fields contd.
JPDeni 7165 Jul 27, 2000, 4:18 PM
Thread Re: sorting radio fields contd.
kellner 7124 Jul 27, 2000, 5:16 PM
Thread Re: sorting radio fields contd.
JPDeni 7122 Jul 27, 2000, 5:24 PM
Thread Re: sorting radio fields contd.
kellner 7139 Jul 28, 2000, 7:04 AM
Thread Re: sorting radio fields contd.
JPDeni 7122 Jul 28, 2000, 7:32 AM
Thread Re: sorting radio fields contd.
kellner 7114 Jul 28, 2000, 9:16 AM
Thread Re: sorting radio fields contd.
JPDeni 7147 Jul 28, 2000, 4:41 PM
Thread Re: sorting radio fields contd.
kellner 7101 Jul 29, 2000, 5:16 AM
Thread Re: sorting radio fields contd.
JPDeni 7133 Jul 29, 2000, 6:05 AM
Thread Re: sorting radio fields contd.
kellner 7121 Jul 29, 2000, 4:23 PM
Post Re: sorting radio fields contd.
JPDeni 7084 Jul 31, 2000, 2:01 AM
Thread Re: [JPDeni] sorting radio fields contd.
dianarae 7049 Jan 7, 2002, 1:15 PM
Thread Re: [dianarae] sorting radio fields contd.
dianarae 7042 Jan 7, 2002, 3:03 PM
Thread Re: [dianarae] sorting radio fields contd.
kellner 7131 Jan 7, 2002, 3:54 PM
Thread Re: [kellner] sorting radio fields contd.
dianarae 7108 Jan 7, 2002, 4:21 PM
Thread Re: [dianarae] sorting radio fields contd.
kellner 7126 Jan 8, 2002, 2:30 AM
Thread Re: [kellner] sorting radio fields contd.
dianarae 1591 Jan 8, 2002, 7:23 AM
Thread Re: [dianarae] sorting radio fields contd.
kellner 1563 Jan 8, 2002, 8:10 AM
Thread Re: [kellner] sorting radio fields contd.
dianarae 1624 Jan 8, 2002, 1:17 PM
Post Re: [dianarae] sorting radio fields contd.
kellner 1614 Jan 8, 2002, 2:27 PM