Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2011-12-21 16:46:24

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: adi_join - Join stuff together

Neat idea Adi

Here’s a snag I just got caught on on:

I want to return a comma separated list of permlinks, but the link text could be either the txp:title or a txp:custom_field value (if it exists) – meaning I can’t just use <txp:permlink />.

So, after resolving the link text into a variable I’m trying to join instances of <a href="<txp:permlink />"><txp:variable name="book_title" /></a> using <txp:adi_join last_separator=" & ">.

From what I get back it seems like the plugin is treating each <txp:tag /> as an item. So there are commas where they shouldn’t be:

<a href="/permlink">, Title, </a>, <a href="/permlink">, Title, </a> & <a href="/permlink">, Title, </a>.

I guess this is a fairly common use case. Would it be possible to add attributes to specify what kind of element constitutes an item. eg. itemtype="html/text" item="a"? Or something…

Offline

#12 2011-12-21 22:18:22

Gocom
Plugin Author
Registered: 2006-07-14
Posts: 4,524
Website

Re: adi_join - Join stuff together

pieman wrote:

From what I get back it seems like the plugin is treating each <txp:tag /> as an item.

Not exactly. Adi_join doesn’t split items based on tags, but line breaks (single LF, CRs do not matter). I would make sure every item is written to single line, and that <txp:variable name="book_title" /> (and title, used custom field) doesn’t contain any line breaks (LF).

Last edited by Gocom (2011-12-21 22:19:47)

Offline

#13 2011-12-21 22:48:29

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: adi_join - Join stuff together

Thanks for clarifying Jukka – that works for me.

Offline

#14 2011-12-22 10:40:02

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: adi_join - Join stuff together

Adi, is this something you’d consider putting on the list for the next version?

Offline

#15 2011-12-22 10:45:11

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,217
Website

Re: adi_join - Join stuff together

pieman wrote:

Thanks for clarifying Jukka – that works for me.

Yep, what he said! (thanks Jukka)

Offline

#16 2011-12-22 10:46:24

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,217
Website

Re: adi_join - Join stuff together

pieman wrote:

Adi, is this something you’d consider putting on the list for the next version?

Of course.

Offline

#17 2015-06-15 12:40:48

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,217
Website

Re: adi_join - Join stuff together

Version 0.3 available for download:

  • new attributes: ‘delimiter’, ‘ignore’ (for pieman)
  • new attribute: ‘unique’
  • TXP 4.6 tag registration

Offline

Board footer

Powered by FluxBB