Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-05-02 17:23:39

anoke
Archived Plugin Author
Registered: 2006-04-15
Posts: 152

current URI/URL?

Can I find it out easily with tags or do I have to resort to using php/plugins?

I want to reverse the sort order of article list. Just simple asc/dec sorting, nothing else. I was thinking of idea of outputting current url, adding url var and then catch it and change the sort order based on that..

I wouldn’t like to use javascript based table listing as it would be a little of an overkill.. (it would work though)


- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -

Offline

#2 2006-05-02 17:38:49

whatbrick
Member
From: Texas
Registered: 2006-03-13
Posts: 100

Re: current URI/URL?

The <a href=“http://textpattern.net/wiki/index.php?title=Txp:article_/”>article</a> tag already supports sorting by asc/desc using the sortdir attribute. The recent_articles and article_custom tags also support this. Unless there’s some other functionality that you need, then this should suffice.


Do not taunt the Markup Monkey!

Offline

#3 2006-05-02 17:58:17

KurtRaschke
Plugin Author
Registered: 2004-05-16
Posts: 275

Re: current URI/URL?

Yes, but I think what anoke is looking for is for the viewer to be able to change the sort order of the displayed list, by passing certain parameters in the URL.

TXP doesn’t offer this functionality by default, but it could certainly be implemented as a patch or plugin. If the goal is to stay within the bounds of ‘stock’ TXP, then a JS-based client-side implementation might be the best thing.

-Kurt

Last edited by KurtRaschke (2006-05-02 17:58:37)


kurt@kurtraschke.com

Offline

#4 2006-05-02 18:17:57

anoke
Archived Plugin Author
Registered: 2006-04-15
Posts: 152

Re: current URI/URL?

yep, I want to change the sort order on the fly

like:
<txp:if-url sortdir="asc">
<article sortdir="asc" />
<txp:else />
<article sortdir="desc" />
</txp:if-url>

IIRC there was a plugin to parse url variables so that wouldn’t be a problem.

The problem is how to create link “To reverse the sort order click here” while linked url being “current_url+&sortdir=asc”.

(I don’t object using plugins but coding them.. :)

Edit: actually something ajax-ish like Strandardista is tempting..

Last edited by anoke (2006-05-02 19:48:15)


- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -

Offline

#5 2006-05-02 20:36:40

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: current URI/URL?

<txp:page_url /> outputs the page url (the part that comes after domain.com).
I think chs_if_urlvar will do what you want.

Last edited by els (2006-05-02 20:36:55)

Offline

#6 2006-05-03 07:13:28

anoke
Archived Plugin Author
Registered: 2006-04-15
Posts: 152

Re: current URI/URL?

Els wrote:

<txp:page_url /> outputs the page url (the part that comes after domain.com).
I think chs_if_urlvar will do what you want.

I remembered something like that existed but it isn’t on the Textbook’s tag list . Wondering how many such tags there is..

And yes, chs_if_url_var was that very plugin, cheers.


- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -

Offline

Board footer

Powered by FluxBB