Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
[SOLVED] Prev/Next Article Thumbnails
Afternoon :¬)
I have searched the web for this, but most of the articles seem to be from a few years ago (using zem’s plugin).
I was wondering if there is an updated plugin, or core functionality, in which to link to the next article using it’s thumbnail?
Thank you!
Last edited by rossharvey (2012-02-10 15:20:53)
Offline
Re: [SOLVED] Prev/Next Article Thumbnails
Hi Ross,
that looks like a task for jmd_neighbor.
Uli also mentioned the existence of <txp:page_url type="prev_id" />
and <txp:page_url type="next_id" />
in this thread, which if it works you could theoretically plug into something like this:
<txp:link_to_prev>
<txp:article_custom id='<txp:page_url type="prev_id" />'>
<txp:article_image thumbnail="1" />
</txp:article_custom>
</txp:link_to_prev>
I’ve never seen that before so I’d be interested to hear if it works.
EDIT: corrected error spotted by Uli. Thanks.
Last edited by jakob (2012-02-10 16:03:15)
TXP Builders – finely-crafted code, design and txp
Offline
Re: [SOLVED] Prev/Next Article Thumbnails
Perfect – thanks Jakob! I’ll have a stab with the plugin first :¬)
Much appreciated.
Offline
Re: [SOLVED] Prev/Next Article Thumbnails
For some reason, the plugin is not working. Even using the exact code in the help file. TXP 4.4.1, and yes, it’s enabled :¬)
The code above works, bar the article_image, it pulls it from the current article.
Core dev guys, please consider adding an ‘id’ (image id) to article_image. That would be awesome.
Offline
#5 2012-02-10 15:12:16
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: [SOLVED] Prev/Next Article Thumbnails
jakob wrote:
[…] which if it works you could theoretically plug into something like this:
<txp:link_to_prev><txp:article_custom id='<txp:page_url type="prev_id" />' /><txp:article_image thumbnail="1" /></txp:article_custom></txp:link_to_prev>
.
Your article custom is selfclosing, jakob.
I don’t know what kind of info exactly link_to_prev
is receiving and from where and whether it can be telecommanded from its content or simply overrules its content here, but it’s certainly worth the try.
I’d go about doing it with a permlink, though:
<txp:article_custom id='<txp:page_url type="prev_id" />'>
<txp:permlink>
<txp:article_image thumbnail="1" />
</txp:permlink>
</txp:article_custom>
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: [SOLVED] Prev/Next Article Thumbnails
Uli – thank you, that fixed it.
Marvellous :¬)
Offline
Re: [SOLVED] Prev/Next Article Thumbnails
Thanks for spotting the error Uli (I’ll correct that) and your suggestion is even neater. Good to know that <txp:article_custom id='<txp:page_url type="prev_id" />'>… any article-related txp tag here … </txp:article_custom>
allows us to get at more than the prev/next title.
TXP Builders – finely-crafted code, design and txp
Offline
#8 2012-02-10 16:17:52
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: [SOLVED] Prev/Next Article Thumbnails
jakob wrote:
Good to know that
<txp:article_custom id='<txp:page_url type="prev_id" />'>… any article-related txp tag here … </txp:article_custom>
allows us to get at more than the prev/next title.
That’s what I guessed here when Jukka posted the global $pretext
thing, but this last half year my brain’s so damn heavy-footed that I still haven’t even tried it out. Thus my question: link_to_prev
would also work, seen from TXP logic?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: [SOLVED] Prev/Next Article Thumbnails
Certainly does, using it here:
http://www.rossharveyweddings.com/creative/wishing-for-spring
<txp:variable name="hasnext" value='<txp:next_title />' />
<txp:if_variable name="hasnext" value="">
<txp:else />
<div class="container">
<txp:article_custom id='<txp:page_url type="next_id" />'>
<div class="column span-3 thumb">
<txp:permlink title='<txp:title />'>
<txp:article_image thumbnail='1' />
</txp:permlink>
</div>
<div class="column span-12 prepend-1 last">
<h2>
<txp:permlink title='<txp:title />'>
<txp:title />
</txp:permlink>
</h2>
</div>
</txp:article_custom>
</div>
</txp:if_variable>
Repeated for prev of course.
{Needed more indentation for myself and pasted it back. – Uli}
Last edited by uli (2012-02-10 21:58:27)
Offline
Re: [SOLVED] Prev/Next Article Thumbnails
I think Uli was wondering whether my earlier variant (now that the syntax error is corrected) that used txp:link_to_prev
as the container tag also works like Uli’s txp:permlink
variant does or whether for some reason <txp:page_url type="prev_id" />
doesn’t work in combination with <txp:link_to_prev>...
my brain’s so damn heavy-footed that I still haven’t even tried it out
Uli, I’d say your brain is as nimble as ever… just neither of us have got round to trying it out.
TXP Builders – finely-crafted code, design and txp
Offline
#11 2012-02-10 22:46:11
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: [SOLVED] Prev/Next Article Thumbnails
jakob wrote:
I think Uli was wondering whether […]
Yup, exactly.
[…] neither of us have got round to trying it out.
And nevertheless we now have a result here – that’s what I love about the forum ;)
There’s a wide range of nice possibilities now, with article_custom’s filtering capabilities, (edit: d’oh, heavyfooted!) nested tags etc.
rossharvey wrote:
Certainly does, using it here:
http://www.rossharveyweddings.com/creative/wishing-for-spring
Cool to see it straightway working in a website :)
Last edited by uli (2012-02-10 23:46:59)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Pages: 1