Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-03-07 17:15:17

mikeg
Member
From: Edmonton, Canada.
Registered: 2005-02-21
Posts: 31
Website

[request] Article Number within a section

I’m looking for a plugin that will return the numeric value of an article’s place within a section.

What I’d like to display is this:

“This is article number “x” in the News section.”

or

“This is the 12th article published in News.”

The plugin should spit out the number only – not the surrounding text. Plugin should consider live articles only and should consider ONLY the section that the article is posted in.

I’ll pay $50.00 USD (via Paypal) to any dev who successfully authors this plugin.

Payment will be made upon successful implementation and final acceptance by me. In the interest of good faith I’m willing to pay half up front. After final acceptance, dev will retain ownership (and management responsibilities) of plugin and may release for general use at his or her option.

Any takers?

If you’re interested, contact me here: michaelgravel.com/contact

(serious inquiries only)


“I love Beethoven. Especially the poems.”
- Ringo Starr

Offline

#2 2007-03-07 19:06:22

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [request] Article Number within a section

check your mailbox ;)

Offline

#3 2007-03-08 22:26:58

mikeg
Member
From: Edmonton, Canada.
Registered: 2005-02-21
Posts: 31
Website

Re: [request] Article Number within a section

Just wanted to update and say that this transaction has been completed. Ruud wrote the code, everything works as expected, and I paid him. Not sure if he’ll release the plugin for general use or not.


“I love Beethoven. Especially the poems.”
- Ringo Starr

Offline

#4 2007-03-08 22:47:31

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [request] Article Number within a section

If others are interested, then I’ll do a public release.

Offline

#5 2007-03-09 16:11:17

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: [request] Article Number within a section

+++1 for controlled release.

Set it free baby, set it free.

Offline

#6 2010-10-31 20:20:26

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [request] Article Number within a section

A bit late, but someone just asked for it so here it is. Please do not post this plugin anywhere else without changing the prefix. It’s an unmaintained plugin.

# rvm_article_number v0.1
# Number of an article in its section
# Ruud van Melick
# http://vanmelick.com/

# ......................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# ......................................................................

YTo5OntzOjc6InZlcnNpb24iO3M6MzoiMC4xIjtzOjY6ImF1dGhvciI7czoxNToiUnV1ZCB2
YW4gTWVsaWNrIjtzOjEwOiJhdXRob3JfdXJpIjtzOjIxOiJodHRwOi8vdmFubWVsaWNrLmNv
bS8iO3M6MTE6ImRlc2NyaXB0aW9uIjtzOjM1OiJOdW1iZXIgb2YgYW4gYXJ0aWNsZSBpbiBp
dHMgc2VjdGlvbiI7czo0OiJ0eXBlIjtpOjA7czo0OiJuYW1lIjtzOjE4OiJydm1fYXJ0aWNs
ZV9udW1iZXIiO3M6NDoiaGVscCI7czoxOTQ6Igk8cD5UaGlzIHBsdWdpbiBhZGRzIHRoZSA8
Y29kZT4mIzYwO3R4cDpydm1fYXJ0aWNsZV9udW1iZXIgLyYjNjI7PC9jb2RlPiB0YWcgd2hp
Y2ggcmV0dXJucyB0aGUgbnVtYmVyIG9mIHRoZSBjdXJyZW50IGFydGljbGUgKG9sZGVzdCA9
IDEpIGluIGl0cyBzZWN0aW9uLiBDYW4gYmUgdXNlZCBvbmx5IGluIGFydGljbGUgY29udGV4
dC48L3A+IjtzOjQ6ImNvZGUiO3M6Mjc4OiIKZnVuY3Rpb24gcnZtX2FydGljbGVfbnVtYmVy
KCkKewogIGdsb2JhbCAkdGhpc2FydGljbGU7CgogIGFzc2VydF9hcnRpY2xlKCk7CgogICR3
aGVyZSA9ICd1bml4X3RpbWVzdGFtcChQb3N0ZWQpIDwgJy4kdGhpc2FydGljbGVbJ3Bvc3Rl
ZCddIC4KICAgICcgQU5EIFN0YXR1cyA9IDQnIC4KICAgICIgQU5EIFNlY3Rpb24gPSAnIi5k
b1NsYXNoKCR0aGlzYXJ0aWNsZVsnc2VjdGlvbiddKS4iJyI7CgogIHJldHVybiBzYWZlX2Nv
dW50KCd0ZXh0cGF0dGVybicsICR3aGVyZSkgKyAxOwp9CiI7czozOiJtZDUiO3M6MzI6ImIx
MjhjNjkyZGVkMmQ4ZTIyMGRkNmU1MDBlMjc0ZmUzIjt9

Offline

#7 2010-10-31 21:21:46

catnip
Member
From: Sydney Australia
Registered: 2006-07-29
Posts: 58
Website

Re: [request] Article Number within a section

Brilliant Ruud. Thanks a lot!

It’s just what I needed.

Looks like the default sort order is “Posted asc”. It would be a much more powerful plug-in if it allowed other sorting options.

Last edited by catnip (2010-11-03 16:35:05)

Offline

#8 2010-10-31 21:28:32

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [request] Article Number within a section

Feel free to modify it. Reverse numbering probably only takes changing the < into > in the $where = line.

Offline

#9 2010-10-31 23:06:44

catnip
Member
From: Sydney Australia
Registered: 2006-07-29
Posts: 58
Website

Re: [request] Article Number within a section

ruud wrote:

Feel free to modify it. Reverse numbering probably only takes changing the < into > in the $where = line.

Thanks Ruud, I don’t know the first thing about PHP, but this looks easy enough.

What about sorting by “ID” instead of by “Posted”?

Last edited by catnip (2010-11-03 16:35:18)

Offline

#10 2010-11-01 18:22:45

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [request] Article Number within a section

Without looking at the code, try replacing “Posted” with “ID” ;)

Offline

#11 2010-11-02 12:56:57

catnip
Member
From: Sydney Australia
Registered: 2006-07-29
Posts: 58
Website

Re: [request] Article Number within a section

Ruud, the two occurrences?

function rvm_article_number()
{
  global $thisarticle;

  assert_article();

  $where = 'unix_timestamp(Posted) < '.$thisarticle['posted'] .
    ' AND Status = 4' .
    " AND Section = '".doSlash($thisarticle['section'])."'";

  return safe_count('textpattern', $where) + 1;
}

Last edited by catnip (2010-11-03 16:34:34)

Offline

#12 2010-11-02 16:02:19

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [request] Article Number within a section

Change

$where = 'unix_timestamp(Posted) < '.$thisarticle['posted'] .

into:

$where = 'unix_timestamp(ID) < '.$thisarticle['thisid'] .

Offline

Board footer

Powered by FluxBB