Page 1 of 1

Bug in News module 2.12.10 (category list can't be filtered)

Posted: Sat Apr 13, 2013 1:53 pm
by yankee80
Hello CMSMS friends,

I think I have found a bug in later versions of the News module (hopefully this is the right part of the forum to post it).

I have two identical sites with PHP/MySQL latest versions.

Site 1:
CMSMS 1.8.1
News 2.10.6

Site 2 (cloned from site one then upgraded to):
CMSMS: 1.11.4
News: 2.12.10

On site 1 the tag below shows me a list of all news categories that are sub categories of the "Hotels" news category
{news action="browsecat" category='Hotels*'}

On site 2 the same tag produces no output

If I change the tag to
{news action="browsecat"}

every single news category is listed (as expected)

I'm not a developer, but my conclusion is that this is a bug in News 2.12.10 (which the module manager claims is the latest version).

many thanks in advance for any help with this issue.

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Sat Apr 13, 2013 2:46 pm
by compufairy
Hi there,

I am not a die hard programmer, but an * in your call can't be good, in many programming languages that is used to calculate (multiply). In all my technical innocence I think Smarty3 does not like your * in the category tag. Maybe Smarty 2 did not mind, but my 2 cents is that Smarty3 surely will.

I am quite sure there is no bug in News...

Anne

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Sat Apr 13, 2013 3:16 pm
by cb2004
A * in a module call usually relates to showing the children of so it should be fine.

Do you have pretty urls on or off?

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Sat Apr 13, 2013 3:21 pm
by cb2004
Ok, I just had a play on a test site. I suspect the category parameter is only used for the summary view. If you wish to display just specific categories using the browsecat action I would do some smarty stuff in a template instead.

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Sat Apr 13, 2013 4:43 pm
by staartmees
CMSMS 1.8.1 is no longer supported and isn't safe anymore. Upgrade to cms 1.11.5 as quick as possible.

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Sat Apr 13, 2013 6:42 pm
by compufairy
lol, I should stick to marketing ;)

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Sun Apr 14, 2013 3:47 am
by yankee80
cb2004 wrote:Ok, I just had a play on a test site. I suspect the category parameter is only used for the summary view. If you wish to display just specific categories using the browsecat action I would do some smarty stuff in a template instead.

thanks for your analysis and replies CB

Pretty URL:s are On

I don't see the rationale behind disabling a feature that works perfectly in an older CMS version.

I'd really appreciate if you could point me in the right direction on how to filter the categories using smarty? Should I parse the output and remove anything that doesn't start with "Hotels"?

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Sun Apr 14, 2013 4:47 pm
by cb2004
If you can do something within a template there is no need to maintain features within the code.

In the category template within the foreach use {$node|print_r} and you can play around with what is returned.

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Thu May 30, 2013 7:31 am
by yankee80
I hope someone can tell me whether I've run into a dead end here.

Goal: To filter the output of the news module's category list to include only subcaterories of main category "ArtEntertainment"

The sub categories are called:
ArtEntertainmentCat1
ArtEntertainmentCat2
ArtEntertainmentCat3

I call the news module like this from my HTML template:

{news action="browsecat" category='ArtEntertainment*' browsecattemplate='SubCatNew' }

and end up with no output (because the "category" and action="browsecat" parameters are not allowed together anymore).

As advised by cb2004 I'm trying to parse the output in the news category-browser template (to filter out unwanted categories) BUT how can I pass the name of the wanted category "ArtEntertainment" available as a variable in the news module browse category template?


I've tried by calling the news module with a new home made parameter "cat"
{news action="browsecat" cat='ArtEntertainment*' browsecattemplate='SubCatNew' }


and in the news template:
------
{foreach from=$cats item=node}
{if $node.count > 0}

[glow]{if $node.news_category_name|strstr:$param_cat} [/glow]
we have a match <br />
{/if}
------

but my homemade parameter "cat" doesn't seem to be available for use.

Is what I'm trying to achieve possible?

thanks in advance

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Thu May 30, 2013 8:07 am
by velden
I quickly looked at the code of news module and then tested it on a website:

cmsms 1.11.7
News 2.12.12

Seems to work like a charm:

Code: Select all

{News action='browsecat' category='testmain*'}
Output:

Code: Select all

    testmain (0)
        testsub1 (0)
        testsub2 (0)
ps. Pretty Urls are on.

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Thu May 30, 2013 8:51 am
by yankee80
fantastic, it works after upgrading to the latest version!

thanks Velden for testing!

Re: Bug in News module 2.12.10 (category list can't be filte

Posted: Wed Jun 05, 2013 2:55 pm
by Mich-adg
Had the same problem after an upgrade to the latest versions (cmsms and news mod). I re-uploaded the news module per ftp and it worked (the upgrade in the back-office wasn't complete, don't know why because i didn't see errors messages...).