Re: putting subcategories of categories into arrays
| From: | Daniel Convissor | Date: | Fri, 21 Jul 2000 16:57:20 +0000 |
| Subject: | Re: putting subcategories of categories into arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7602@lists.php.net to get a copy of this message | ||
Heya:
> On Fri, 21 Jul 2000, Stephen Schneider wrote:
>
> > here's where I'm stuck, and maybe it is easier than I'm making it. I want
> > to loop through and display a category and under it display all it's
> > subcategories.
Here's some code I have to display the list of questions in my FAQ:
if ( isset($CatFileQuestion) ) {
# Some faq files exist. List them.
# Sort the categories alphabetically.
ksort($CatFileQuestion);
echo "<ul>";
while ( list($Category,$Nothing) = each($CatFileQuestion) ) {
# Sort the answers in this category alphabetically.
asort($CatFileQuestion[$Category]);
# Display the category name.
echo "<li><h2>$Category</h2><ul>\n";
while ( list($File,$Question) = each($CatFileQuestion[$Category]) ) {
# Now display each question in this category.
echo "<li><a
href=\"sqlfaq.htm?ID=$File\">$Question</a></li>\n";
}# End of WHILE questions.
echo "</ul></li> \n";
}# End of WHILE category.
echo "</ul>\n";
}# End of IF isset.
Modify as you see fit.
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
More than just answers. Solutions. (SM)
http://www.analysisandsolutions.com/
4015 7 Av #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409