Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2013-01-14 00:53:40

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,394
Website

Re: weighting stories for news site

etc wrote:

You are right, Jonathan, link_to_next will not work with sort="custom_1+0 DESC, custom_2+0 DESC, LastMod DESC", but the reason (as I get it) is not custom_1+0, but multiple sort axes. For the same reason, it will fail with sort="DATE(Posted) DESC, custom_1 ASC". But I have seen a tip that can be used here if needed.

I just tried this two days ago on a site I was developing – but only with <txp:article limit="999" sort="custom_2+0"> i.e just one sort method. That works fine with older and newer but not link_to_prev or link_to_next. So I’m not sure it fails due to multiple sorting?

Offline

#12 2013-01-14 08:44:16

etc
Developer
Registered: 2010-11-11
Posts: 3,203
Website

Re: weighting stories for news site

jstubbs wrote:

I just tried this two days ago on a site I was developing – but only with <txp:article limit="999" sort="custom_2+0"> i.e just one sort method. That works fine with older and newer but not link_to_prev or link_to_next. So I’m not sure it fails due to multiple sorting?

Multiple sorting will fail, but you are right again, it does not even switch to Posted desc with sort="custom_2+0", but gives something weird. Now that I look at the code again, this is to be expected, so one should probably mention it in the documentation? And probably modify getPrevNext function to treat complex constructions like this one.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#13 2013-01-14 10:38:08

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,394
Website

Re: weighting stories for news site

You are probably right Oleg that it would be a good idea to mention this to the devs, but maybe someone with more advanced PHP skills like yourself could discuss the issues in the docs? Unless it deserve to be listed as a new issue?

Offline

#14 2013-01-14 15:50:20

etc
Developer
Registered: 2010-11-11
Posts: 3,203
Website

Re: weighting stories for news site

That’s not a real issue, just an overlook. I don’t know how to submit proposals, sorry if this is not the appropriate place, but I would replace

if (empty($m[0]) || count($m) > 2 || preg_match('/[),]/', $m[0]))

in getNextPrev function by something like

if (empty($m[0]) || count($m) > 2 || !preg_match('/^(?:[0-9,a-z,A-Z$_\x{0080}-\x{FFFF}]+|`[\x{0001}-\x{FFFF}]+`)$/u', $m[0]))

I will also try another solution that respects any sort order and report back if the performance is decent.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#15 2013-01-14 16:56:01

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,678
Website

Re: weighting stories for news site

etc wrote:

I don’t know how to submit proposals

If your testing works out and you think your patch is useful, you can raise an issue which will give us good visibility of it and we can track its progress. Patches are welcome but if you’re not comfortable with a diff tool, you can just outline the issues and fix as you have done here. Feel free to link to forum posts/this thread from your issue, to serve as background reading.

Last edited by Bloke (2013-01-14 16:56:33)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#16 2013-01-14 19:18:45

etc
Developer
Registered: 2010-11-11
Posts: 3,203
Website

Re: weighting stories for news site

Done, thanks for the guidance.

Last edited by etc (2013-01-14 20:07:16)


etc_[ query | search | pagination | date | tree | cache ]

Offline

Board footer

Powered by FluxBB