, Guest!
Already a Member? Login or Register.

Menu



Showcase


Due to the volume of spam happening on our forums, posting is now restricted to verified members only.  If you're not verified, drop us a note with your username.

Home > FlexCMS Support Forum > User Help > General Support Requests > Multiple Categories in news

FlexCMS Support Forum


Multiple Categories in news
Started September 3, 2006 @ 8:42pm by cberks
Post Message 
cberks


Posts: 63
 
Multiple Categories in newsSeptember 3, 2006 @ 8:42pm
When creating news articles one can assign multiple categories to an individual article however when including in a page the system appears to only look at the first category of an article

Code

test multiple categories



ARTICLES CAT 1
third article - both cata and catb
third article - both cata and catb... [Read More]

first article
first article -- cat a

ARTICLES CAT 2
second article
second article - cat b... [Read More]


the third article should appear in both sections


Regards, Chris
 
DCSun
Administrator



Posts: 625
 
September 4, 2006 @ 12:24am
Chris,

Correct you are. That's definitely a bug. It will be fixed in the next release.

In the meantime, you can fix it on your site by opening up index.php and finding this line (approx line 1410):

Code

$query_na = "SELECT * FROM `".$Settings['DBPrefix']."na-Articles` WHERE ApprovedBy!='' AND Category IN (".$CategoriesList2.") ORDER BY DateCode DESC LIMIT ".$LimitString;

and replacing it with this:
Code

$query_na = "SELECT * FROM `".$Settings['DBPrefix']."na-Articles` WHERE ApprovedBy!='' AND (Category IN (".$CategoriesList2.") OR Category2 IN (".$CategoriesList2.") OR Category3 IN (".$CategoriesList2.") OR Category4 IN (".$CategoriesList2.") OR Category5 IN (".$CategoriesList2.")) ORDER BY DateCode DESC LIMIT ".$LimitString;



David


FlexCMS v3.2 Has Been Released!
 
cberks


Posts: 63
 
PROBELM WITH MULTIPLE CATEGORIESOctober 12, 2006 @ 10:11pm
Using the code you supplied works fine for multiple categories except that if one sets categorylist to say 0,1 one gets news articles that are uncategorized and in category 1 AND ALSO those categories in the teens such as 11, 12, 13 etc !!!!

O could see how may be the IN select might select article of cat 1 in a list including 17 but not select 17 from a list including 1???

Regards, Chris
 
DCSun
Administrator



Posts: 625
 
October 12, 2006 @ 11:07pm
Chris,

Try changing this line (a few up from where the other ones were)


Code

$CategoriesList2 = implode(',',$CategoriesArray);


to this


Code

$CategoriesList2 = '"'.implode('","',$CategoriesArray).'"';


and see if that solves your problem.


If not, you might want to try with and without the zero category, as that may be including all the categories, but I would have to test the code more thoroughly to see for sure.


David


FlexCMS v3.2 Has Been Released!
 
cberks


Posts: 63
 
MULTIPLE CATEGORIESNovember 22, 2006 @ 8:23pm
Could you provide some guidance on how to change the multiple categories code in this thread to a logical AND rather than the current logical OR - I want an alternative so I can select articles which are each categorised cat A AND cat B
 
DCSun
Administrator



Posts: 625
 
November 23, 2006 @ 10:28am

Code

$query_na = "SELECT * FROM `".$Settings['DBPrefix']."na-Articles` WHERE ApprovedBy!='' AND (Category IN (".$CategoriesList2.") AND Category2 IN (".$CategoriesList2.") AND Category3 IN (".$CategoriesList2.") AND Category4 IN (".$CategoriesList2.") AND Category5 IN (".$CategoriesList2.")) ORDER BY DateCode DESC LIMIT ".$LimitString;


The only change to make it work like that is the "OR"s become "AND"s.

EnjoySmile


Dave



FlexCMS v3.2 Has Been Released!
 
cberks


Posts: 63
 
ANDNovember 23, 2006 @ 3:58pm
but I think that does not allow the article to have category vaolue outside the set one has chosen ie one wants all artickes categorized as dance AND movie and wants to get both of

article categoprized dance movie classical

and dance movie jazz

I think maybe one has to do the OR as ther selection and when inside the display loop only display of thew # of categories hits for a particuloar entry equals the # of categoriesa one is ANDING I('ll try and see if I can gtet it to work

Thanks, Chris
 
DCSun
Administrator



Posts: 625
 
November 23, 2006 @ 5:34pm
I think you lost me there, Chris! But have a go at it and see if you can make it do what you need. If not, I'll see if there's anything I can do to help.


David


FlexCMS v3.2 Has Been Released!
 

Post Message 




Try & Buy FeedForAll - Easy to use RSS Feed Creator - great for iTunes users!

MEMBERS




All Contents, Code, Scripts and Technologies Copyright 2003-2009 FlexCMS.
All Rights Reserved. Software License Agreement

Processing Time: 0.08610 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS