Textpattern Forum

You are not logged in. Register | Login | Help

#21 2007-04-26 17:00:04

progre55
Member
Registered: 2006-05-02
Posts: 642

Re: [plugin] [ORPHAN] jk_neighbour: just like link_to_next/prev, only a bit better

Jeff:

Hope this helps:

<txp:jk_link_to_prev cat=“home" showalways="1">
		[SQL (0.001756): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from textpattern where title > '9 East Wind' and Section = 'real-estate-listings-homes'  and Status=4 and Posted < now() order by title asc limit 1]
		[SQL (0.001795): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from textpattern where title < '9 East Wind' and Section = 'real-estate-listings-homes'  and Status=4 and Posted < now() order by title desc limit 1]
		[SQL (0.001851): select *,ID as thisid, unix_timestamp(Posted) as posted from textpattern where ID=29]
	</txp:jk_link_to_prev>
	<txp:jk_link_to_next cat=“home" showalways="1">
		[SQL (0.001849): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from textpattern where title > '9 East Wind' and Section = 'real-estate-listings-homes'  and Status=4 and Posted < now() order by title asc limit 1]
		[SQL (0.001591): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from textpattern where title < '9 East Wind' and Section = 'real-estate-listings-homes'  and Status=4 and Posted < now() order by title desc limit 1]
	</txp:jk_link_to_next>

Let me know what else you may need.

Funny, looking at the code ift defnitely is using section although the code I put in is:

<txp:jk_link_to_prev cat=“home" showalways="1">
<IMG SRC="/core_images/listing_prev.jpg" ALT="" align=top border=0>
</txp:jk_link_to_prev><txp:jk_link_to_next cat=“home" showalways="1">
<IMG SRC="/core_images/listing_next.jpg" ALT="" align=top border=0></txp:jk_link_to_next>

Thanks.

progre55

Last edited by progre55 (2007-04-26 17:04:23)

Offline

#22 2007-04-26 17:33:00

Jeff_K
Plugin Author
From: Vancouver, British Columbia
Registered: 2005-08-19
Posts: 202
Website

Re: [plugin] [ORPHAN] jk_neighbour: just like link_to_next/prev, only a bit better

Okay. I think I tracked down the error. Try version .35 (posted above).

Also, just to clarify, the plugin filters by section by default, and there is, at present, no way to override this behaviour. If you want it to show results from all sections, I would have to modify the code.

Offline

#23 2007-04-30 14:23:52

progre55
Member
Registered: 2006-05-02
Posts: 642

Re: [plugin] [ORPHAN] jk_neighbour: just like link_to_next/prev, only a bit better

Jeff:

Jeff:

Thanks for the update. One more (hopefully minor item) … is it possible to sort by a custom field … I would like the previous/next not to be limited to Title or date entered, but to be sorted by a custom field …

I tried sortby=“custom_1” with no success and also the same thing, but replacing the custom field with the actual name.

Any assistance would be greatly apprreciated.

Thanks.

progre55

Offline

#24 2007-05-01 07:30:00

Jeff_K
Plugin Author
From: Vancouver, British Columbia
Registered: 2005-08-19
Posts: 202
Website

Re: [plugin] [ORPHAN] jk_neighbour: just like link_to_next/prev, only a bit better

Hm.. sortby=“custom_1” should work. Does the field always have a value? Can you turn back on debugging and post the SQL queries again. Thanks.

Last edited by Jeff_K (2007-05-01 07:30:37)

Offline

#25 2007-05-05 06:32:17

LetterHoofd
Member
From: Kortrijk, BE
Registered: 2006-01-20
Posts: 40
Website

Re: [plugin] [ORPHAN] jk_neighbour: just like link_to_next/prev, only a bit better

This plugin seams very valuable. However it only works with published articles. I use my txp-installation as a calendar for upcoming events. It would be great if you could add an extra atribute, such as time=“future/past/all”.

Offline

#26 2007-05-05 08:44:58

Jeff_K
Plugin Author
From: Vancouver, British Columbia
Registered: 2005-08-19
Posts: 202
Website

Re: [plugin] [ORPHAN] jk_neighbour: just like link_to_next/prev, only a bit better

Version .4 supports articles with posted dates in the future. Just set the “showfuture” attribute to “1”.

Offline

#27 2007-05-11 19:48:57

mattgilbert
Member
Registered: 2006-03-23
Posts: 70

Re: [plugin] [ORPHAN] jk_neighbour: just like link_to_next/prev, only a bit better

Hi,

I can’t seem to get sortby=“posted” to work. In my case, it always fails to return a link_to_next, and it always returns the same link_to_prev, no matter what the current article is. Here’s the relevant debug info:

<txp:jk_link_to_next cat="current" sortby="posted" >
		[SQL (0.001107): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from mattgilbertnet_textpattern where posted > '2007-04-07 03:30:35' and Section = 'article'  and category1 = 'Acoustics' and Status=4 and Posted < now() order by posted asc limit 1]
		[SQL (0.001012): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from mattgilbertnet_textpattern where posted < '2007-04-07 03:30:35' and Section = 'article'  and category1 = 'Acoustics' and Status=4 and Posted < now() order by posted desc limit 1]
	</txp:jk_link_to_next>
	<txp:jk_link_to_prev cat="current" sortby="posted" >
		[SQL (0.001044): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from mattgilbertnet_textpattern where posted > '2007-04-07 03:30:35' and Section = 'article'  and category1 = 'Acoustics' and Status=4 and Posted < now() order by posted asc limit 1]
		[SQL (0.001009): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from mattgilbertnet_textpattern where posted < '2007-04-07 03:30:35' and Section = 'article'  and category1 = 'Acoustics' and Status=4 and Posted < now() order by posted desc limit 1]
		[SQL (0.001816): select *,ID as thisid, unix_timestamp(Posted) as posted from mattgilbertnet_textpattern as textpattern where ID=20]
	</txp:jk_link_to_prev>

Is sortby=“posted” not working?

Offline

#28 2007-05-11 20:00:54

Jeff_K
Plugin Author
From: Vancouver, British Columbia
Registered: 2005-08-19
Posts: 202
Website

Re: [plugin] [ORPHAN] jk_neighbour: just like link_to_next/prev, only a bit better

Try v.45. Should be fixed.

Offline

#29 2007-05-12 01:45:53

mattgilbert
Member
Registered: 2006-03-23
Posts: 70

Re: [plugin] [ORPHAN] jk_neighbour: just like link_to_next/prev, only a bit better

I’m still getting the same behavior. When I tried the tags without specifying a “cat” attribute, jk_link_to_next returns the newest article and jk_link_to_prev returns the second newest article. I hope that helps.

Here’s the debug stuff from when there’s no “cat” attribute:

<txp:jk_link_to_next sortby="posted" >
		[SQL (0.000986): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from mattgilbertnet_textpattern where posted > '2007-04-07 03:26:50' and Section = 'article'  and Status=4  order by posted asc limit 1]
		[SQL (0.004960): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from mattgilbertnet_textpattern where posted < '2007-04-07 03:26:50' and Section = 'article'  and Status=4  order by posted desc limit 1]
		[SQL (0.001717): select *,ID as thisid, unix_timestamp(Posted) as posted from mattgilbertnet_textpattern as textpattern where ID=23]
	</txp:jk_link_to_next>
	<txp:jk_link_to_prev sortby="posted" >
		[SQL (0.000790): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from mattgilbertnet_textpattern where posted > '2007-04-07 03:26:50' and Section = 'article'  and Status=4  order by posted asc limit 1]
		[SQL (0.000834): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from mattgilbertnet_textpattern where posted < '2007-04-07 03:26:50' and Section = 'article'  and Status=4  order by posted desc limit 1]
		[SQL (0.001294): select *,ID as thisid, unix_timestamp(Posted) as posted from mattgilbertnet_textpattern as textpattern where ID=21]
	</txp:jk_link_to_prev>

Offline

#30 2007-05-13 04:56:33

Jeff_K
Plugin Author
From: Vancouver, British Columbia
Registered: 2005-08-19
Posts: 202
Website

Re: [plugin] [ORPHAN] jk_neighbour: just like link_to_next/prev, only a bit better

Matt,

I can’t seem to replicate this behavior on my server. The query above should be returning a result if one exists. You might want to double check that the posted date in the query reflects the date of the current article shown. Also, you could add “print_r($thenext); print_r($theprev);” at the end of the plugin and before the “return $out; }”, and see if it returns a pair of arrays with the correct article information — which it should.

Offline

Board footer

Powered by FluxBB