Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-06-11 12:16:20

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

ack! archive article thumbnail navigation display!

If you look at my web site you see a nifty new front page feature, showing thumbs for the last 4 photographs. It uses this code:

<txp:article form=“photo_archive_list” limit=“4” offset=“1” pgonly=“0” searchall=“1” sort=“Posted desc” status=“4” />

I want that display consistent in my photo-archive pages, but it screws up: what you get is just one thumb, for the same large photo/article.

Any ideas?

Also, ideally, I’d like the thumb display to alter dynamically so you see the previous 4 photo/posts in relation to whatever photo/article you are looking at. At the moment, it refers to the last 4 posts for the entire site only – and stays that way.

Offline

#2 2010-06-11 12:44:18

SuMu
Member
From: Germany - Wuppertal
Registered: 2008-03-06
Posts: 242
Website

Re: ack! archive article thumbnail navigation display!

hi
you want to have it so:
Foto-Archiv

My code:
<txp:rss_suparchive section="blog" limit="100" form="tools-archivliste" />

This is my “Baustein” (Building block)

<txp:if_different>
</div><div class="bildarchiv"><h3><txp:posted format="%Y" /></h3>
</txp:if_different><txp:permlink><txp:article_image thumbnail="1" /></txp:permlink>

viele Grüße
SuMu

Psychomuell + blogZicke

Offline

#3 2010-06-11 21:57:39

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,925
Website GitHub

Re: ack! archive article thumbnail navigation display!

One idea: Are all your articles photos, James (it looks like it from my cursory glance)? If so, you could perhaps use txp:article_custom with the id attribute, e.g. id="1518,1517,1516,1515" to display the previous four article thumbnails. You can use txp:article_id to retrieve the current id into a variable and adi_calc or a small php snippet to calculate the next 4 article ids.

Last edited by jakob (2010-06-11 21:58:12)


TXP Builders – finely-crafted code, design and txp

Offline

#4 2010-06-12 03:55:55

SuMu
Member
From: Germany - Wuppertal
Registered: 2008-03-06
Posts: 242
Website

Re: ack! archive article thumbnail navigation display!

oh sorry I understood totally wrong


viele Grüße
SuMu

Psychomuell + blogZicke

Offline

#5 2010-06-12 09:15:01

keith
Member
From: Blyth, Northumberland, England
Registered: 2004-12-08
Posts: 199
Website

Re: ack! archive article thumbnail navigation display!

SuMu wrote:

oh sorry I understood totally wrong

Don’t worry SuMU – you’ve helped me! Your idea does just what I want for my site!

Viel dank!


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

#6 2010-06-14 09:10:50

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

Re: ack! archive article thumbnail navigation display!

jakob wrote:

One idea: Are all your articles photos, James (it looks like it from my cursory glance)? If so, you could perhaps use txp:article_custom with the id attribute, e.g. id="1518,1517,1516,1515" to display the previous four article thumbnails. You can use txp:article_id to retrieve the current id into a variable and adi_calc or a small php snippet to calculate the next 4 article ids.

I don’t fully understand this. Although I’ve been using txp for years, I’ve never been able to master it. If this is a simple concept for you, could you maybe provide the code I’d need to build this? – what needs to go in the page, and what the form would consist of.

One point though – not all my articles are photos. I’ve got another section for ‘words’.

Offline

#7 2010-06-15 10:21:17

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,925
Website GitHub

Re: ack! archive article thumbnail navigation display!

One point though – not all my articles are photos. I’ve got another section for ‘words’.

If that’s the case, the above idea won’t work and I think you have to use a custom query made with smd_query for this. Install and activate smd_query if you don’t already have it installed and try this:

<txp:variable name="timestamp" value='<txp:posted format="%Y-%m-%d %H:%M:%S" />' />
<txp:smd_query column="*" table="textpattern" where="Posted < '?timestamp' AND Section='photos' AND Status=4 ORDER BY Posted desc LIMIT 4">

<a href="<txp:permlink id="{ID}" />" title="Permanent link to “<txp:category name="{Category1}" title="1" />: {Title}”">
	<txp:thumbnail id="{Image}" />
</a>
</txp:smd_query>

What this does is retrieve the timestamp of the current article and puts it in a variable for use with smd_query, then does a custom query looking for the next 4 live articles in the section “photos” that were posted after before that timestamp.

I’m not entirely sure how you have your photos named/categorised and what information shows in the title tag. In the example above I have used “category1: title”. In Safari, however, the title/alt of the image are shown on rollover, not those of the link. If you want to avoid that you’ll need to use an image plugin like upm_image (you may already be using this) which gives you more control over your markup output and replace <txp:thumbnail id="{Image}" /> in the above code with this:

	<txp:upm_image image_id="{Image}" type="thumbnail" show_alt="no" show_title="no" />

Last but not least, you have a nice site there with impressive scenic photos!

Last edited by jakob (2010-06-15 13:42:02)


TXP Builders – finely-crafted code, design and txp

Offline

#8 2010-06-19 13:48:54

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

Re: ack! archive article thumbnail navigation display!

Many thanks. Been away and just seen this, now I’m going to see if I can get it to work….

Offline

#9 2010-06-19 14:02:04

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

Re: ack! archive article thumbnail navigation display!

Hmmm. Well, so far with both versions of that code/form I’m getting this display with no thumbs:

‘ /> ‘ /> ‘ /> ‘ /> ‘ /> ‘ /> ‘ /> ‘ /> ‘ /> ‘ />

The way I insert/identify the images is with txp code like this:

<txp:image id=“1906” />

Last edited by jameslomax (2010-06-19 14:19:43)

Offline

#10 2010-06-19 15:38:10

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,925
Website GitHub

Re: ack! archive article thumbnail navigation display!

Hi James,

I had a look at your source code and it seems to be working at least in part because I can see the code for the 4 links being produced but the thumbnails don’t show and it looks like there’s a problem with the quotes (the 66-99 quotes in my code above are now straight quotes in the source code). Also the four images are being output 10 times over (e.g. 10 × 4 links) with the ' /> appearing every fourth image which suggest to me that you may have pasted the code inside another txp:article loop (10 is the default value for limit) that is now not closing properly.

If you are willing, it might be easier to fix if you give me a temporary login so I can find out what exactly is happening. You can contact me via the email button.


TXP Builders – finely-crafted code, design and txp

Offline

#11 2012-11-19 13:18:58

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

Re: ack! archive article thumbnail navigation display!

This is working now (and has been for a while) but I may now want to change the thumbnail display from 4 to 8 or possibly 12 photos.

I can do this easily – even me! – by changing the 4 value to 8 or12:

<txp:smd_query column=”*” table=“textpattern” where=“Posted < ‘?timestamp’ AND Section=‘photos’ AND Status=4 ORDER BY Posted desc LIMIT 4”>
<a href=”<txp:permlink id=”{ID}” />” class=“prev_thumb_link num_{smd_thisrow}” title=“Permanent link to “<txp:category name=”{Category1}” title=“1” />: {Title}””>
{Excerpt}
</a>
</txp:smd_query>

However when I do this the thumbnails display as rows of 4, 3, 3 and 2, instead of three rows of four.

Can anyone see why this is happening and what the solution is? Many thanks!

Offline

#12 2012-11-19 16:25:00

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

Re: ack! archive article thumbnail navigation display!

jameslomax wrote:

However when I do this the thumbnails display as rows of 4, 3, 3 and 2, instead of three rows of four.

Possibly a CSS issue. Could you post a link?


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

Offline

Board footer

Powered by FluxBB