Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#25 2004-11-25 17:00:39
- Remillard
- Plugin Author
- From: Lenexa, KS
- Registered: 2004-05-16
- Posts: 169
Re: mdn_count
I’ve got a quickly thrown together hack. It’s not tested and I don’t have a particularly good way to test it either (as I don’t use categories particularly.)
If someone wouldn’t mind trying this out, and letting me know if it does the intersection thing right, I’d appreciate it.
Hope it works :).
EDIT: As far as I could tell, the SQL you had up there was getting close to what I did. I tend not to use the table and field labels unless it’s really onerous to do so, and I used count() instead of distinct, because why do the count myself if the database can do it faster and more optimized than I can? :). But basically all it needed was a way to tell if both were specified, and then modify the SQL statement accordingly.
Last edited by Remillard (2004-11-25 17:05:04)
Offline
#26 2004-11-25 18:35:32
- humanoid
- Member
- Registered: 2004-06-24
- Posts: 17
Re: mdn_count
Ok – Let’s see
Installing….
Is it correct you didn’t change the Plugin name etc? I see this in my plugin list when installing:
mdn_count Mark Norton 1.2 Provides a count of the number of live articles by section or category, or both.
Hmm, I think I did something wrong, I used it like this on the frontpage:
<txp:mdn_count category="#" />
And then I get:
mdn_count: You did not specify section or category.
If I do:
<txp:mdn_count category="books" />
Then I get the correct number.
I was thinking actually you would let it output a list of categories? So the changes you are focussing on is that it only count categories within a certain section right? Tricky to test for me also, because I restrict certain categories to certain sections. I could play around with it though and will do so after my sports-training I have to attend now.
I will let you know my results.
Offline
Re: mdn_count
‘checked it out. it works :) beautifully.
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
#28 2004-11-25 19:40:14
- Remillard
- Plugin Author
- From: Lenexa, KS
- Registered: 2004-05-16
- Posts: 169
Re: mdn_count
Yes, the beta has the same name. Just the rev updates and the description a little.
Well… you need to be careful on the front page. If there is NO category context and you are saying “take it from the current category” (i.e. the # selection), then yes, it will fail. You would have to call the front page with http://mysite.com/?c=Somecategory and then the # would work because there is an established category context.
I did create some test cases on my test page and it looks like it’s picking things up. I’m glad alicson got good results too. Let me know humanoid if you can get it working for yourself.
Last edited by Remillard (2004-11-25 23:19:28)
Offline
Re: mdn_count
i didn’t try it on the front page… just on the archive page..
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
#30 2004-11-29 12:45:34
- humanoid
- Member
- Registered: 2004-06-24
- Posts: 17
Re: mdn_count
Hi, yeah it works OK if I call it with c=something. Maybe make it possible to suppres the error message? Or “enable verbose”. Then you could use it much more freely.
Thanks and regrads, Ed
Offline
Re: mdn_count
‘just to be sure… you don’t have to specify a category at all, right? you can just have a ‘section’ attribute… and no reference to category at all… right?
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
#32 2004-11-29 18:25:38
- Remillard
- Plugin Author
- From: Lenexa, KS
- Registered: 2004-05-16
- Posts: 169
Re: mdn_count
No, you don’t have to specify a category at all. Not a problem. You just have to specify SOMEthing.
However that being said, I can see a point to having at least blank output. I’ll make the debug line quiet and then if nothing is output, then it’s because there were no valid matches for counting. I’ll bump that to 1.2 live as soon as I can recompile.
Done. 1.3 is at the download site.
Last edited by Remillard (2004-11-29 18:48:58)
Offline
#33 2004-11-30 04:50:52
- Remillard
- Plugin Author
- From: Lenexa, KS
- Registered: 2004-05-16
- Posts: 169
Re: mdn_count
Version update. There was a logic error in which it could count draft articles if the category match was in category2. It’s been fixed.
Offline
#34 2004-12-10 16:05:23
- humanoid
- Member
- Registered: 2004-06-24
- Posts: 17
Re: mdn_count
Yo! I used it now like this
Lots of manual work still, but hey – it works:
<a href="http://metsuke.net/?c=books" style="font-size: <txp:mdn_count category="books" />px" >books</a>
is in a form called “counter” and repeated for each category
Then I did a small calculation in the plugin (multiply the output with some constant) for the px sizes. Probably I should have better done that within the page template, but I do not know how to do php in templates.
Don’t take the site to seriousl – it is my playground.
Offline
#35 2004-12-10 17:57:43
- Remillard
- Plugin Author
- From: Lenexa, KS
- Registered: 2004-05-16
- Posts: 169
Re: mdn_count
I think that’s pretty cool :). Different sizes depending on how many things you’ve written there. Even more interesting would be if your readers noticed it over time that it wasn’t just a interesting style, but was actually dynamic!
Offline
Re: mdn_count
I use v1.4 of this plugin on my rc1 site in combination with rss_suparchive <a href=“http://neme.org/main/index.php?id=22” target=”_blank”>here</a> but I would also like to use it as a general article counter in the whole of my site (which I probably can’t)
ie on the default first page I would like to have: previous 10 (entries) of (total number of entries).
As sites get larger and larger it would be great for a surfer to know how many ‘clicks’ they have left before they reach the end of the site.
If i am right and this plugin can not count the total numer of articles, can someone point me to a method or a plugin that does?
thanks in advance
Last edited by colak (2005-04-16 08:37:35)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline