1
_info?>Read FAQ
body<=
(Back to FAQ Index)
quote($FORM{'faqcat'});
my %faqcat;
my %faqq;
$sth = $dbh->prepare("SELECT faqcat, faqcatname, catorder FROM faqcat WHERE faqcat=$qfaqcat");
$sth->execute;
while ($_ = $sth->fetchrow_hashref)
{
$faqcat{$_->{'faqcat'}} = $_;
}
$sth = $dbh->prepare("SELECT faqid, question, sortorder, faqcat, answer, lastmodtime FROM faq WHERE faqcat=$qfaqcat");
$sth->execute;
while ($_ = $sth->fetchrow_hashref)
{
$faqq{$_->{'faqid'}} = $_;
}
foreach my $faqcat (sort { $faqcat{$a}->{'catorder'} <=> $faqcat{$b}->{'catorder'} } keys %faqcat)
{
$ret .= "" . LJ::ehtml($faqcat{$faqcat}->{'faqcatname'}) . "
\n";
$ret .= "\n";
foreach my $faqid (sort { $faqq{$a}->{'sortorder'} <=> $faqq{$b}->{'sortorder'} } grep { $faqq{$_}->{'faqcat'} eq $faqcat } keys %faqq)
{
next unless ($faqq{$faqid}->{'question'});
BML::note_mod_time($faqq{$faqid}->{'lastmodtime'});
my $q = LJ::ehtml($faqq{$faqid}->{'question'});
$q =~ s/^\s+//; $q =~ s/\s+$//;
$q =~ s!\n!
!g;
my $a = LJ::ehtml($faqq{$faqid}->{'answer'});
$a =~ s/^\s+//; $a =~ s/\s+$//;
$a =~ s/\n( +)/"\n" . " "x length($1)/eg;
$a =~ s!\n!
!g;
$ret .= "" . LJ::auto_linkify($a);
}
$ret .= "
\n";
}
return $ret;
_code?>
<=body
page?>
lib: cgi-bin/ljlib.pl
link: htdocs/admin/faq/index.bml
_c?>