Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2007-06-01 19:10:01

ultramega
Member
Registered: 2006-02-26
Posts: 221

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

Ok, nice :) I earlier had basic article lists in wrong order too, because their collation/ lang setting in mysql was wrong. Now when the collation in article field is fixed, they print out right. Should that be enough for this plugin too?

Offline

#38 2007-06-07 15:45:08

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

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

Jeff, thank you very very much for releasing this plugin! It was so awfully needed!


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#39 2007-06-24 16:59:58

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

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

I’ve recently discovered a “loophole” jk_neighbour leaves, an undescribed, more unwanted state I could make use of to create a navigation for certain gallery situations. But you can of course use this as well for matters other than the described one.

Let’s assume you have some pictures in your gallery that resemble each other too much to be represented on the gallery overview pages each with it’s own thumbnail. But on the other hand, when viewed in a larger scale the small differences between them become visible, so you want to show them at least on the individual article pages (see demo below), but only as secondary motifs to the parent image.

The trick now is to use jk_neighbour’s attribute sortby=“posted” and to set the date and time of the parent image and all of it’s children images to exactly the same values (btw, an ideal job for upm_savenew). The consequence is that the jk_neighbour nav (1) can leaf through only those images shown on the gallery overview page (see demo below), leaving out the “children” that kind of hide in a row behind each other on the exact same point in time, and this way the sequential order shown in the gallery overview is kept intact when navigating with jk_neighbour.

But the “hidden” images need their own nav (2), which they will get right now. This nav should appear only on the parent’s resp. their cildren’s page. This can be accomplished by applying the extremely versatile chh_related_articles, which – in my case – creates this nav by detecting a custom field relation. As my client’s similar images often are named identically, I’ve decided to use numbers over names, claiming the help of a further custom field.

Demo:
Gallery overview page
Parent image page (individual article)

As it’s a German site, I’ve added these explaining screenshots:

(1) The nav jk_neighbour creates is this one:

(2) Children images can be reached with the chh_related_articles nav on the right of the image:

Last edited by uli (2007-06-25 19:51:45)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#40 2007-08-23 02:37:45

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

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

Jeff (or anyone else):

I am looking to use this plug in on a current project, but I need it to sortby a custom field. I can not get it to work.

When I try to use it, I only get the “Next” button and it references the same article over and over again.

<txp:jk_link_to_prev sortby="custom_4" >
[SQL (0.001774): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where custom_4 > '' and Section = 'sports'  and Status=4 and Posted < now() 
order by custom_4 asc limit 1]
[SQL (0.001311): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where custom_4 < '' and Section = 'sports'  and Status=4 and Posted < now() 
order by custom_4 desc limit 1]
</txp:jk_link_to_prev>
<txp:jk_link_to_next sortby="custom_4" >
[SQL (0.001644): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where custom_4 > '' and Section = 'sports'  and Status=4 and Posted < now() 
order by custom_4 asc limit 1]
[SQL (0.001316): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where custom_4 < '' and Section = 'sports'  and Status=4 and Posted < now() 
order by custom_4 desc limit 1]
[SQL (0.000259): select ID as thisid, Section as section, Title as title, url_title, 
unix_timestamp(Posted) as posted from textpattern where ID = 10]
</txp:jk_link_to_next>

I can use the plug in, but it only appears to work for me if I select sortby=title.

Any guidance would be greatlt appreciated.

progre55

I was on the board a couple of months ago about this topic, but got side tracked and wound up using a different solution. This time I really need this plug in.

Thanks again.

Last edited by progre55 (2007-08-23 02:43:10)

Offline

#41 2007-08-24 18:24:32

Jeff_K
Archived 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

I just uploaded v.46 which should fix the problem. Just realized that TXP only stores custom fields as their field name in $thisarticle.

Let me know if it works for you now.

Offline

#42 2007-08-24 18:45:28

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

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

Jeff_K:

Unfortunately, still not working. Please take a look:

<txp:jk_link_to_prev sortby="custom_4" >
[SQL (0.001481): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where custom_4 > 'baseball' and Section = 'sports'  and Status=4 and Posted < now() order by custom_4 asc limit 1]
[SQL (0.001647): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where custom_4 < 'baseball' and Section = 'sports'  and Status=4 and Posted < now() order by custom_4 desc limit 1]
</txp:jk_link_to_prev>
<txp:jk_link_to_next sortby="custom_4" >
[SQL (0.001495): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where custom_4 > 'baseball' and Section = 'sports'  and Status=4 and Posted < now() order by custom_4 asc limit 1]
from textpattern where custom_4 < 'baseball' and Section = 'sports'  and Status=4 and Posted < now() order by custom_4 desc limit 1]
[SQL (0.000321): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted 
from textpattern where ID = 11]
</txp:jk_link_to_next>

Now I see the previous and next link (just one of them each time) but they stick on the same property.

progre55

Last edited by progre55 (2007-08-24 21:25:01)

Offline

#43 2007-08-29 20:42:37

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

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

Jeff:

Just wondering if you had a chance to take a look?

Thanks.

progre55

Offline

#44 2007-08-29 21:00:00

Jeff_K
Archived 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

Hey. Sorry, just saw your post. So on a different article, what are you seeing in debug? Do you see “custom_4 < ‘baseball’” or “custom_4 > ‘baseball’”

Offline

#45 2007-08-29 21:26:53

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

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

Jeff:

Tried it on another site using the following code:

<txp:jk_link_to_prev sortby="custom_4"> Previous </txp:jk_link_to_prev>
<txp:jk_link_to_next sortby="custom_4"> Next </txp:jk_link_to_next>

When I do so, I get an article with a prev link appearing only.

Below is the code for that page:

<txp:jk_link_to_prev sortby="custom_4">
[SQL (0.001391): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where custom_4 > 'Single Home' and Section = 'model homes'  and Status=4 and Posted 
< now() order by custom_4 asc limit 1]
from textpattern where custom_4 < 'Single Home' and Section = 'model homes'  and Status=4 and Posted 
< now() order by custom_4 desc limit 1]
[SQL (0.000308): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as 
posted from textpattern where ID = 10]
</txp:jk_link_to_prev>
<txp:jk_link_to_next sortby="custom_4">
[SQL (0.001347): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where custom_4 > 'Single Home' and Section = 'model homes'  and Status=4 and Posted 
< now() order by custom_4 asc limit 1]
[SQL (0.001518): select ID, Title, url_title, unix_timestamp(Posted) as uposted
from textpattern where custom_4 < 'Single Home' and Section = 'model homes'  and Status=4 and Posted 
< now() order by custom_4 desc limit 1]
</txp:jk_link_to_next>

When I hit the previous link, I get another article with a next link and the following code:

<txp:jk_link_to_prev sortby="custom_4">
[SQL (0.001490): select ID, Title, url_title, unix_timestamp(Posted) as uposted from textpattern where custom_4 > 
'model property' and Section = 'model homes'  and Status=4 and Posted < now() order by custom_4 asc limit 1]
[SQL (0.001309): select ID, Title, url_title, unix_timestamp(Posted) as uposted from textpattern where custom_4 < 
'model property' and Section = 'model homes'  and Status=4 and Posted < now() order by custom_4 desc limit 1]
</txp:jk_link_to_prev>
<txp:jk_link_to_next sortby="custom_4">
[SQL (0.001399): select ID, Title, url_title, unix_timestamp(Posted) as uposted from textpattern where custom_4 > 
'model property' and Section = 'model homes'  and Status=4 and Posted < now() order by custom_4 asc limit 1]
[SQL (0.001287): select ID, Title, url_title, unix_timestamp(Posted) as uposted from textpattern where custom_4 < 
'model property' and Section = 'model homes'  and Status=4 and Posted < now() order by custom_4 desc limit 1]
[SQL (0.000258): select ID as thisid, Section as section, Title as title, url_title, unix_timestamp(Posted) as posted 
from textpattern where ID = 11]
</txp:jk_link_to_next>

If this helps at all, the custom field is numeric and has been changed in the database to reflect that so that it sort properly when a search is done.

Offline

#46 2007-08-31 13:17:13

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

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

Jeff:

Just wondering if the additional info was of any help?

Thanks.

progre55

Offline

#47 2007-09-05 01:26:46

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

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

Jeff:

Sorry for being a pain, but hoping you were able to figure out my problem.

Please let me know.

progre55

Offline

#48 2007-09-05 06:56:11

Jeff_K
Archived 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

Hey, sorry. Been pretty busy lately. Mot sure really what’s going on. You say the custom field is numeric? But the SQL says the field is “model property” for the record you are looking at. Can you clarify?

“select ID, Title, url_title, unix_timestamp(Posted) as uposted from textpattern where custom_4 < ‘model property’ and Section = ‘model homes’ and Status=4 and Posted < now() order by custom_4 desc limit 1” should return a result if one exists.

Offline

Board footer

Powered by FluxBB