I am trying to implement the N-13 Wiki code sample that allows you to "Show articles that are NOT assigned to specified categories." It works fine on my test page except that clicking on any link in the Older News section, which should show you the rest of the articles not assigned to specified categories, shows all articles.
I think this is related to my having friendly URLs, but I can't figure out how to modify the template so this works.
Has anybody implemented the Wiki help code and needed more than one page to show results?
The code is:
<?php
require_once('news/db.php');
require_once('news/config.php');
// Specify here which categories you DON'T want to use
$nocats = array();
$nocats[] = "Cat1";
$nocats[] = "Cat2";
$nocats[] = "Cat4";
// Grab all existing categories so we can check if the ones specified above exists or not
$allcats = DataAccess::fetch("SELECT id, name FROM " . NEWS_CATS);
$j = 0;
$nocatids = array();
foreach($allcats AS $acat){
if(in_array($acat['name'],$nocats)){
// Categories which do exist get added to the $nocatids array
$nocatids[] = $acat['id'];
$j++;
}
}
// Implode the $nocatids array so that it can be used in a query to select all other categories
$nocatids = implode(",", $nocatids);
$nocats = DataAccess::fetch("SELECT name FROM " . NEWS_CATS . " WHERE id NOT IN ($nocatids)");
unset($cat);
$cat = array();
foreach($nocats AS $nocat){
// Assign all the selected categories to the $cat array
$cat[] = $nocat['name'];
}
include 'news/index.php';
?>
but if there's more than one page of code and you are using Friendly URL's, clicking on the next page link brings you articles in the $nocatids group. What I need is a way to limit the next page to the categories not listed in $nocatids.
I'm really stuck here - any help would be appreciated.