Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-10-26 21:32:12

jben.net
Member
From: Bath, UK
Registered: 2005-09-23
Posts: 10
Website

Reverse Section order - txp:popup

hi,

is it possible to reverse the order that a section list is displayed?

What I’d like is to do:

txp:popup type=“s” dir=“desc”

so much like in SQL I could order the list either ASC or DESC.

Actually, ideally I’m after a lot more flexibility, so I could do…

txp:popup type=“s” sort=“name” dir=“desc” or txp:popup type=“s” sort=“created” dir=“desc”

is there a plugin that can do this?

Thanks,

Jon

Last edited by jben.net (2005-10-26 21:33:21)

Offline

#2 2005-10-26 22:04:17

jben.net
Member
From: Bath, UK
Registered: 2005-09-23
Posts: 10
Website

Re: Reverse Section order - txp:popup

ok,
I’ve managed to do it, but very crudely by manaually over-writing the popup funtion:

<snip>
function popup($atts) {

extract(lAtts(array( ‘label’ => ‘’, ‘wraptag’ => ‘’, ‘type’ => ‘’ ),$atts));

$q[] = “order by name DESC”;
</snip>

Anyone got any ideas how I can do this in plugin format or another more future proof way? It could easily be extended to allow for another 2 params within the txp:popup call like so:

<snip>
function popup($atts) {

extract(lAtts(array( ‘label’ => ‘’, ‘wraptag’ => ‘’, ‘type’ => ‘’, ‘sort’ => ‘’, ‘dir’ => ‘’, ),$atts));

$q[] = “order by “. $sort.” “.$dir”;
</snip>

any ideas? I’m very new to TXP, so might be going about things in a roundabout fashion!

Thanks,

Jon

Last edited by jben.net (2005-10-26 22:05:34)

Offline

Board footer

Powered by FluxBB