[- use Glossary; $escmode = 0; $cat = 'nsbri'; -]
[- $sql = "SELECT lower(word) FROM glossary WHERE category='$cat'"; $sth = &Glossary::execQuery( $sql ); $count = 0; while ( @dat = $sth->fetchrow ) { $count++; $Letters{ substr($dat[0],0,1) }++; } $sql = "SELECT * FROM glossary WHERE category='$cat' ORDER BY lower(word)"; $sth = &Glossary::execQuery( $sql ); -] [$ if ( $count == 0 ) $] No nsbri terms available. [$ else $]
[$ foreach $let ( @Glossary::Letters ) $] [$ if ( $Letters{$let} ) $][+uc($let)+][$ endif $] [$ endforeach $]
[- $lastlet = ''; -]
[$ while ( @dat = $sth->fetchrow ) $] [- $term = &Glossary::clean( $dat[0] ); $basedir = $Glossary::BaseDIR . "$cat/"; $baseurl = $Glossary::BaseURL . "$cat/"; if ( -e "$basedir$term.jpg" ) { $image = "$baseurl$term.jpg"; } elsif ( -e "$basedir$term.gif" ) { $image = "$baseurl/$term.gif"; } else { $image = ''; } if ( $image ne '' ) { $imagecode = qq("); } else { $imagecode = ''; } $letter = substr($dat[0],0,1); $letter =~ tr/a-z/A-Z/; -]
[+$dat[0]+]
[+$imagecode+][+$dat[1]+]

[$ endwhile $]

[- $sth->finish; -]
[$ foreach $let ( @Glossary::Letters ) $] [$ if ( $Letters{$let} ) $][+uc($let)+][$ endif $] [$ endforeach $]
[$ endif $]