Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#169 2021-10-18 14:35:58
Re: Dev news
BTW, which features of list processing would be useful? Currently, txp 4.8.8 can
- sort a list, in ascending/descending/random order;
- filter/alter it via
trim
andreplace
attributes; - remove duplicates via valueless
replace
; - extract some of list items, via
limit/offset
attributes; - loop-parse list items via
breakform
.
What else?
Online
#170 2021-10-18 16:39:52
Re: Dev news
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#171 2021-10-18 18:17:41
Re: Dev news
colak wrote #331820:
As long as we can still combine them with
custom_field
s:)
Still? AFAIK, custom fields in 4.8.7 have no ‘list’ feature, and in 4.8.8 you can use it with any tag, including <txp:custom_field />
. As for the future cf branch, I guess cf will have their own attributes that will take priority over the global ones.
I’m still unsure how to handle sort
attribute: should the default be case-insensitive, like in MySQL? How to trigger the case-sensitive mode then? What about the ‘natural’ mode, where, say, img9.png
precedes img10.png
? Should it be something like sort="natcase asc"
? Ideas welcome.
Online
#172 2021-10-19 05:31:06
Re: Dev news
etc wrote #331821:
Still? AFAIK, custom fields in 4.8.7 have no ‘list’ feature, and in 4.8.8 you can use it with any tag, including
<txp:custom_field />
.
Maybe I’m missunderstanding what you mean with. list
. In the article docs:
custom_n
where n is the number of your custom field…
also
<txp:article colour="red" />
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#173 2021-10-19 09:58:52
Re: Dev news
colak wrote #331824:
Maybe I’m missunderstanding what you mean with. list. In the article docs:
I have certainly been not clear enough. Nothing changes for <txp:article />
and other ‘listing’ tags that handle these (sort
etc) attributes themselves. It’s just about the ability to process the non-listing tags output as lists, like some plugins do.
For example, order keywords alphabetically:
<txp:keywords breakby="," break=", " sort />
Or display two random article images:
<txp:images id='<txp:custom_field name="article_image" breakby="," sort="rand" limit="2" />' />
Note that the latter can already be achieved in 4.8.7 in another way:
<txp:images id='<txp:custom_field name="article_image" />' sort="rand()" limit="2" />
Online
#174 2021-10-19 13:54:38
Re: Dev news
etc wrote #331826:
It’s just about the ability to process the non-listing tags output as lists, like some plugins do.
For example, order keywords alphabetically:
<txp:keywords breakby="," break=", " sort />...
Or display two random article images:
<txp:images id='<txp:custom_field name="article_image" breakby="," sort="rand" limit="2" />' />...
Note that the latter can already be achieved in 4.8.7 in another way:
<txp:images id='<txp:custom_field name="article_image" />' sort="rand()" limit="2" />...
Oh!!! I understand now. Sounds yummy!!!
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#175 2021-11-12 10:47:53
Re: Dev news
The behaviour of the global escape
attribute has been slightly changed when applied to lists. For example,
<txp:article_custom break=" and " escape="upper"><txp:title /></txp:article_custom>
in 4.8.7 would output
TITLE ONE AND TITLE TWO AND ...
and in 4.8.8 it will be
TITLE ONE and TITLE TWO and ...
Any objections to this?
Online
#176 2021-11-12 12:26:00
Re: Dev news
The 4.8.8 behaviour seems more logical to me. The escape is being applied to the content, the break
is added verbatim. I like it.
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
#177 2021-11-12 15:03:43
Offline
#178 2021-11-12 16:23:29
Re: Dev news
Thanks lot Oleg!
I changed a very complex SQL query with this instead:
<txp:article_custom section='<txp:section />' break="" wraptag="ul" break="li" trim='/(.*)(@\s?)(\d+\))?/' sort="Title asc"><txp:title /></txp:article_custom>
Depending on my article titles in this form:
Title @number
The expected result is an unordered list of ascendant numbers 🤪
Last edited by Pat64 (2021-11-12 16:26:38)
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
#179 2021-11-13 09:25:03
Re: Dev news
etc wrote #331934:
Any objections to this?
That seems more sensible, I think. I never used that transform though :).
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
#180 2021-11-16 04:49:23
Re: Dev news
@etc
From your example:
<txp:variable name="fruits" value="apple,banana,cranberry" />
<txp:variable name="fruits" breakby="," break="," sort="rand" />
Is there a way to remove duplicate data in order to keep only one?
<txp:variable name="fruits" value="apple,banana,cranberry,apple" />
<txp:variable name="fruits" breakby="," break="," sort="rand" />
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline