Excluding Specific Categories
Is there a way to exclude a specific category from the main list/news feed?
we're trying to avoid the doubling of headlines that appear on our homepage...
thanks in advance!
If the category list options are set up within the News section editor, I use something like the following...
list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'where' => ' category NOT LIKE "%YourCategoryName%" ',
Replace YourCategoryName with the name of your desired category.
thank you for the response... how would we implement this on the page...?
generates this error
"MySQL Error: Unknown column 'category' in 'where clause'"
(new page for code attached....)
That code should work if your list of categories is in the same table.
If your list of categories is in a separate table (i.e. Get options from database), try using the record number instead of the label.
For example, if the record number for the external category to exclude is record number 4, then:
'where' => 'category NOT LIKE "4" ',
See if that works.
Hi Deborah... we finally got this work with a little playing around, Note the "CategoryNum" as opposed to the suggested "category" in the statement (make a mental note of that)...
now the question is: Do you know the syntax for excluding more than 1 category?
'where' => ' categoryNum NOT LIKE "9" ',
thanks for all ur help so far!
Osga, try this:
'where' => ' categoryNum NOT LIKE "9" AND categoryNum NOT LIKE "5"',