Hi.
You are on the right way.
Give every entry a column with category, and set a variable with a category. Before echoing it, just make a if check for the category, and a (evadable) if check for the subcategory.
if($entryCategory==$SelectedCategory)
{
if(($entrySubCategory==$SelectedSubCategory) || ($entrySubCategory==0))
{
echo $entry;
}
}
you can use get to set the selected category:
$SelectedGategory=htmlentities($_GET["Category"]);
should work out.
if you want to support multiple categories, make the column a string, explode for whitespaces, and make the check using a for loop for every number existent in the string.
if($Categories!="")
{
$choices= explode(" ", $Options);
$arrLength = count($choices);
for($i = 0; $i < $arrLength; $i++)
{
if($choices[$i]==$SelectedCategory)
{
echo $Entry; //show entry
$i=$arrLength; //escape the loop
}
}
}
Didn't test it, and php isn't my main language, but I think this should work out.
To support sub-categories, either repeat the whole process where I now echo the entry (with adjusted variables, ofc), or just treat sub-categories like normal categories internally.