We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Category Count

Development and Programming

Zac G.'s avatar
Zac G.
268 posts
15 years ago
Zac G.'s avatar Zac G.

Hey Jim,

Currently it doesn’t do this, but I can add that functionality…

Out of curiosity, are you using it for EE 1.6 or 2.0?

Cheers, Zac

       
Jim Pannell's avatar
Jim Pannell
187 posts
15 years ago
Jim Pannell's avatar Jim Pannell

Hey Zac

Currently for 1.6, but it’s looking more and more likely that I’ll be using version 2 soon.

Cheers

Jim

       
Davor's avatar
Davor
114 posts
15 years ago
Davor's avatar Davor

Very nice plugin, is there a way to count numers of entries in open category?

Something like this?

{exp:catcount cat_id="{segment_3}" status="open|close"} 
{segment_3} = C16 ?

so without using exp:weblog:categories and :entries? I need to show something like this “this category has 35 entries”

Maybe there is a better way to do that, but cant remember :(

thanx again

       
Zac G.'s avatar
Zac G.
268 posts
15 years ago
Zac G.'s avatar Zac G.

Hi Davor,

Sorry, I might not understand exactly what you mean. Are you just looking to use the url segment to serve as the category id or were you looking for all open entries across all categories?

Cheers, Zac

       
Davor's avatar
Davor
114 posts
15 years ago
Davor's avatar Davor

Hi Zac

sorry, yes, I need to use segment id, but as he has that “C” letter, I’m already using it to other custom query with SEGMENT operation to split it, but I get error when need to use it with your plugin, as I’m not so good at php, do you think or know what is best way to use category that is open, only one.

thanx

       
Zac G.'s avatar
Zac G.
268 posts
15 years ago
Zac G.'s avatar Zac G.

Hey Davor,

I might not have the time to add this patch to the official plugin, but here is a patch that will work.

Open up the pi.catcount.php file and on line number 25 and 26 you should see the following:

$cat_id = $TMPL->fetch_param('cat_id');
$status = $TMPL->fetch_param('status');

Insert the following in between the two lines so it looks like this:

$cat_id = $TMPL->fetch_param('cat_id');
$cat_id = substr($cat_id ,1);
$status = $TMPL->fetch_param('status');

Note that this will only work now if you pass it a url segment that has the C at the front of it.

When I get some more time I will post a solution that can automatically figure out if the C is at the front of the parameter value.

Please let me know if this works for you!

Zac

       
Todd Levy's avatar
Todd Levy
20 posts
15 years ago
Todd Levy's avatar Todd Levy

Hey Zac -

Thanks for the effort on this plugin.

Before I throw out all my custom code (see here) and switch to this I’ve got a question and an idea.

First, I’m wondering if it includes future dated posts in the category count? Ideally not, but figured I’d ask.

Also, not sure if you’re planning any upgrades, but one thing I’ve done with my code is allowed for a minimum posts threshold so it’ll only show categories with more than a certain number of posts. That way you can use it for a “popular categories” type sidebar item.

Thanks for considering these ideas and again for the effort.

TL

       
Zac G.'s avatar
Zac G.
268 posts
15 years ago
Zac G.'s avatar Zac G.

Hey Todd,

These are some good points to consider in extending the plugin. I should have some time in the next few days to get back into the plugin and make some changes. I’ll post back up when I have it done!

Cheers and thanks for the suggestions, Zac

       
Kurt Deutscher's avatar
Kurt Deutscher
827 posts
15 years ago
Kurt Deutscher's avatar Kurt Deutscher

Hi Zac G.

Just put this into play counting cats in an EE 2.0 site and it works like a charm.

*pun intended… and too good to pass up.

Thanks so much!

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.