Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#181 2021-11-16 09:50:14
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
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
Offline
#184 2021-11-16 10:00:11
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
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
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
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
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