Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-11-14 10:00:27

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 220
Website

Get every single line of excerpt

Hey guys, I am tying to find a way to let the user in the backend add different dates to an article.
I was thinking to let him put in the excerpt something like this:

12-11-2020 11.30. a.m.
12-11-2020 4.30. p.m.
13-11-2020 10.00. a.m.
13-11-2020 1.00. p.m.

What would be a clever way to split this entry so that I could access each day (+time) seperately?

Offline

#2 2020-11-14 10:41:17

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: Get every single line of excerpt

With the risk of stating the obvious – could you use custom fields instead? There is a factory limit of 10, is that enough?

Offline

#3 2020-11-14 10:55:28

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 220
Website

Re: Get every single line of excerpt

I wanted to avoid using custom fields because I am not sure if 10 will be enough and it will blow up the backend by so many fields. I thought it would be more elegant to let the user put his data in an “by line” basis. But thank you anyway for trying to help.

Offline

#4 2020-11-14 11:03:15

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 220
Website

Re: Get every single line of excerpt

I just found adi_list
I will give it a try and let you know if that worked fine for me.

Offline

#5 2020-11-16 10:52:17

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 220
Website

Re: Get every single line of excerpt

In the end I went with a combination of pax_grep and rah_repeat to build a selectbox from each line of my excerpt:

<txp:variable name="options">
 <txp:pax_grep delimiter="|" from="/<\/?p>/|/\t/|/<br\s*\/?>/" to="||,">
  <txp:excerpt/>
 </txp:pax_grep>
</txp:variable>
<select name="somename" id="someid">							
 <txp:rah_repeat trim="1" value='<txp:variable name="options"/>'><option value="<txp:rah_repeat_value />"><txp:rah_repeat_value /></option></txp:rah_repeat>
 </select>

Maybe somebody has a prettier idea?

Offline

Board footer

Powered by FluxBB