Textpattern Forum

You are not logged in. Register | Login | Help

#71 2010-11-05 18:21:56

Bill Grimm
New Member
From: Colorado
Registered: 2010-01-25
Posts: 8

Re: mdn_count

That works great! Thank you very much! Though you may want to add the option ‘all’ to the time attribute in case people want a total count of all articles (like it used to supply)? I don’t have a use for that myself, though.

I was actually needing it to tell me if I have more than a certain number of articles in a section so I could then provide a link to the rest of them (with excerpts on the opening list). I could not find a way to use txp:variable to do this comparison, so I modified the return value from mdn_count to basically give me a yes or no type of value instead of the actual count (send back a 5 if there are more than 5 articles — the number of articles I give a preview for — or a 0 if there are 5 or fewer). I could then use txp:variable to determine the answer to the yes/no question of whether I needed a link or not.

Have I gone roundabout on an issue that has a simpler solution?

Last edited by Bill Grimm (2010-11-05 18:26:32)

Offline

#72 2010-11-06 01:53:04

cain-mi
Plugin Author
Registered: 2005-07-03
Posts: 101
Website

Re: mdn_count

Well it depends if you are going to use mdn_count in any other part of your templates/forms. If this is your only use of this plugin, then modifying it as you have it probably the best method. If you want to use this plugin again (using the way it was originally coded – to return a number), then you’re better off wrapping it in smd_if – use something like this:

<txp:smd_if field='<txp:mdn_count section="foobar" />' operator="gt" value="5">
do stuff here for more than five articles
<txp:else />
do stuff here for 5 or less articles
</txp:smd_if>

In regard to adding all as a value for the time attribute, this isn’t necessary because it accepts multiple values – you can use now,past,future and every single article will be counted.

Cheers,
cain-mi

Last edited by cain-mi (2013-10-10 05:31:46)

Offline

#73 2010-11-11 05:44:46

ax
Member
From: Germany
Registered: 2009-08-19
Posts: 90

Re: mdn_count

Would be nice, if it could count files, links, and images in the same way as it counts articles.

Last edited by ax (2010-11-11 05:46:12)

Offline

#74 2010-11-18 05:56:19

cain-mi
Plugin Author
Registered: 2005-07-03
Posts: 101
Website

Re: mdn_count

ax wrote:

Would be nice, if it could count files, links, and images in the same way as it counts articles.

That’s a little out of plugin scope sorry. If you have a look at the plugin code, you may be able to do it yourself – a bit of MySQL is all that’s needed.

Last edited by cain-mi (2011-02-27 05:32:08)

Offline

#75 2010-11-26 15:45:30

geoff777
Plugin Author
From: Benarrabá Andalucía Spain
Registered: 2008-02-19
Posts: 271
Website

Re: mdn_count

Hi does this plugin support multiple sections?

ie section=“section1,section2,….,section99” ?

Thanks


There are 10 types of people in the world: those who understand binary, and those who don’t.

Offline

#76 2010-11-27 04:04:49

cain-mi
Plugin Author
Registered: 2005-07-03
Posts: 101
Website

Re: mdn_count

geoff777 wrote:

Hi does this plugin support multiple sections?

Hi Geoff,

It certainly does. Just put them all in separated by commas (as you have above), and it should be right to roll :)

Last edited by cain-mi (2010-11-27 04:06:33)

Offline

#77 2010-11-27 09:16:04

geoff777
Plugin Author
From: Benarrabá Andalucía Spain
Registered: 2008-02-19
Posts: 271
Website

Re: mdn_count

Hi thanks for the quick reply.

I’ll install it and give it a try.

Any chance of adding custom fields … ?


There are 10 types of people in the world: those who understand binary, and those who don’t.

Offline

#78 2010-11-27 13:48:43

cain-mi
Plugin Author
Registered: 2005-07-03
Posts: 101
Website

Re: mdn_count

geoff777 wrote:

Any chance of adding custom fields … ?

Care to elaborate what you mean? Count custom fields that have names? Or additional custom fields added by plugins?

Last edited by cain-mi (2011-02-27 05:32:26)

Offline

#79 2010-11-29 20:11:12

geoff777
Plugin Author
From: Benarrabá Andalucía Spain
Registered: 2008-02-19
Posts: 271
Website

Re: mdn_count

To the count filter … count where section=“x” category1 =“y” and custom_field1=“z”

I use a custom_field name=“frontpage” that is either yes/no I’d like to be able to count all my “frontpage” articles.

Thanks
Geoff

Last edited by geoff777 (2010-11-29 20:12:13)


There are 10 types of people in the world: those who understand binary, and those who don’t.

Offline

#80 2010-11-30 00:57:57

cain-mi
Plugin Author
Registered: 2005-07-03
Posts: 101
Website

Re: mdn_count

Okay I see what you mean, similar to customfieldname. This is a pretty specific scenario, but I think it could be done with a couple of generic attributes, filterfield and filtervalue. That way you could use if for custom fields, and other users could use if for any other column in the table.

OK, I’ll add it to the list :)

Cheers,
cain-mi

Last edited by cain-mi (2013-10-10 05:31:56)

Offline

Board footer

Powered by FluxBB