My plugin's SQL selecting only single category entries
Posted: Sat Nov 19, 2005 6:34 am
I'm writing a plugin to move all entries of a particular category from the mainpage listing to a separate box. I consider it a "newsbox".
I'm taking baby steps. First step: remove the entries of that category from the main listing.
Keeping in mind that I'll eventually want the newsbox to contain multiple categories, I added this SQL to the 'and' attribute in the frontend_fetchentries hook:
Sure enough, the entries in that category (let's call it "Programming" to make things easier) are removed from the frontpage.
However, entries in multiple categories including "Programming" (like "Programming", "Java", "Games") are *not* removed from the listing.
What in the world is going on? I'm reasonably new to SQL, so I must be missing something, but four hours of debugging efforts haven't helped. Maybe you guys can point out the obvious point I'm overlooking.
I'm taking baby steps. First step: remove the entries of that category from the main listing.
Keeping in mind that I'll eventually want the newsbox to contain multiple categories, I added this SQL to the 'and' attribute in the frontend_fetchentries hook:
Code: Select all
(NOT EXISTS
(SELECT 'x' FROM serendipity_entries
WHERE ec.entryid = e.id AND ec.categoryid IN (40))
)
However, entries in multiple categories including "Programming" (like "Programming", "Java", "Games") are *not* removed from the listing.
What in the world is going on? I'm reasonably new to SQL, so I must be missing something, but four hours of debugging efforts haven't helped. Maybe you guys can point out the obvious point I'm overlooking.