Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Core development
  3. » Dev news

#181 2021-11-16 09:50:14

etc
Developer
Registered: 2010-11-11
Posts: 5,132
Website GitHub

Re: Dev news

Pat64 wrote #331957:

Is there a way to remove duplicate data in order to keep only one?

I wouldn’t guess it myself, but yes:

<txp:variable name="fruits" value="apple,banana,cranberry,apple" replace break="," />

Or all at once:

<txp:variable name="fruits" value="apple,banana,cranberry,apple" replace break="," sort="rand" output />

Offline

#182 2021-11-16 09:55:12

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,626
GitHub Twitter

Re: Dev news

Oh!

<txp:variable name="fruits" value="apple,banana,cranberry,apple" replace break="," sort="rand" output />

That’s perfect! Thank you lot!

So, if I will understand, an empty replace attribute do the trick?


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#183 2021-11-16 09:57:45

etc
Developer
Registered: 2010-11-11
Posts: 5,132
Website GitHub

Re: Dev news

Pat64 wrote #331965:

So, if I will understand, an empty replace attribute do the trick?

Yes, I have not found any better use for it, and don’t like introducing new attributes (performance…)

Offline

#184 2021-11-16 10:00:11

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,626
GitHub Twitter

Re: Dev news

That’s very cool!


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#185 2021-11-16 16:41:07

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,626
GitHub Twitter

Re: Dev news

I’m sorry Oleg, maybe I misunderstood, but I can’t get a comma separated list of article IDs:

<txp:variable name="my_var" break="," replace><txp:article_custom section='<txp:section />' break="" wraptag="" exclude="1" limit="999"><txp:article_id /></txp:article_custom></txp:variable>

There are no commas here:

<txp:variable name="my_var" sort="asc" />

Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#186 2021-11-16 16:44:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,413
Website GitHub

Re: Dev news

Put the break="," in the <txp:article_custom> tag instead :)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#187 2021-11-16 16:53:48

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,626
GitHub Twitter

Re: Dev news

Bloke wrote #331974:

Put the break="," in the <txp:article_custom> tag instead :)

Yep! You’re a master.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#188 2021-11-16 18:22:26

etc
Developer
Registered: 2010-11-11
Posts: 5,132
Website GitHub

Re: Dev news

Pat64 wrote #331973:

I’m sorry Oleg, maybe I misunderstood, but I can’t get a comma separated list of article IDs:

<txp:variable name="my_var" break="," replace><txp:article_custom section='<txp:section />' break="" wraptag="" exclude="1" limit="999"><txp:article_id /></txp:article_custom></txp:variable>...

I’m a bit puzzled: article IDs are unique..?

Offline

  1. Index
  2. » Core development
  3. » Dev news

Board footer

Powered by FluxBB