Scoop -- the swiss army chainsaw of content management
Front Page · Everything · News · Code · Help! · Wishlist · Project · Scoop Sites · Dev Notes · Latest CVS changes · Development Activities
Scoop Box Exchange - Show Box: faq_display 1.00

Author: hillct [Info]

Description:

This box takes a section and displays all the stories in that section in a FAQ-style format. This box is best deployed as an OP. It lists the titles of each story in a section as FAQ questions with named targets pointing ot each of the intro texts as the answer and links to the body text (using the displaystory OP) as answer 'details'.

Box Code:

my($content,$answers);
my $section=$S->{CGI}->param('section');
my $title=qq{FAQ: }.$S->{SECTION_DATA}->{$section}->{title};
my ($rv, $sth) = $S->db_select({
WHAT => 'sid, title,introtext,bodytext,commentstatus',
FROM => 'stories',
WHERE => qq{section = "$section" AND displaystatus >=0},
ORDER_BY => 'time DESC'});

# Add the link for each story
while (my $story = $sth->fetchrow_hashref()) {
$content .= qq{<li><A HREF="#$story->{sid}">$story->{title}</a><br>\n};
my $comments = $S->_commentcount($story->{sid});
$answers .= qq{<br><a name="$story->{sid}"></a><b>$story->{title}</b><br>\n
$story->{introtext}<br>
<table border=0 width=100%><tr><td align=left>|norm_font|};
if($story->{bodytext} ne ''){
$answers .= qq{<A HREF="|rootdir|/story/$story->{sid}">Details >></a>
};
if($story->{commentstatus}==0 \|\| ($story->{commentstatus}==1 && $comments)){
$answers .= qq{ ($comments Comments)};
}
} elsif($story->{commentstatus}==0 \|\| ($story->{commentstatus}==1 && $comments)){
$answers .= qq{<A HREF="|rootdir|/story/$story->{sid}">Comments >></a> ($comments)};
}
$answers .= qq{|end_norm_font|</td><td align=right>
|norm_font|[|end_norm_font|<a href="#top"
>|norm_font|Top|endnorm_font|</a>|norm_font|]|end_norm_font|
</td></tr></table><br>};
}

$content=qq{|norm_font|$content<br><br>$answers|end_norm_font|};

# And return the content, like normal.
return {content => $content, title => $title};
Announcement and Discussion
Display: Sort:
Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
The OpenNIC
Democratically operated Domain Name System; using Scoop since Jan. 2001.

Login
Make a new account
Username:
Password:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 1999 The Management

create account | faq | search