I am trying to sort a list of movie reviews in chronological order. We have two options users can choose from, chronological and alphabetical. The page defaults to alphabetical, but when people click on the chronological option, nothing happens.
Here is the code we have right now:
// category 3 is 'reviews', category 12 is 'dvd reviews'
if (($GLOBALS["CategoryId"] == 3 || $GLOBALS["CategoryId"] == 12) && !isset($_GET['unsort']))
{
$output = AL_HELPER::GetArticles($articleResult);
}
else
{
$output = AL_HELPER::GetArticlesABC($articleResult);
}
What I did was flip-flop the two ifs. Putting GetArticles first and GetArticlesABC second- meaning it looked like this:
// category 3 is 'reviews', category 12 is 'dvd reviews'
if (($GLOBALS["CategoryId"] == 3 || $GLOBALS["CategoryId"] == 12) && !isset($_GET['unsort']))
{
$output = AL_HELPER::GetArticlesABC($articleResult);
}
else
{
$output = AL_HELPER::GetArticles($articleResult);
}
It did indeed sort the reviews chronologically but it took away all of the alphabetical options. Essentially it was a long list of chronological reviews. So obviously that's not what we want.
Does anyone know how to limit the number of items that it lists on the page? Or maybe a completely different approach is needed here, if so, any suggestions?