Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-07-16 21:11:21

Myusername
Member
Registered: 2019-12-12
Posts: 141

breakform and breakby

I’m trying to split the output of articles, but I’m having trouble understanding the breakform.

I’m trying something like this:

<txp:article form="default" breakform="article-break" breakby="1, 1, 3"/>
<!-- article-break -->
<div>
	<+>
</div>

Am I wrong to think the result must be this?

<div>
	<article></article>
</div>
<div>
	<article></article>
</div>
<div>
	<article></article>
	<article></article>
	<article></article>
</div>

But the result is being this:

<div><article></article></div>
<div><article></article></div>
<div><article></article></div>
<div><article></article></div>
<div><article></article></div>

With break it worked perfectly, but I need more than just a div, so I’m trying breakform.

Offline

#2 2021-07-16 21:41:27

etc
Developer
Registered: 2010-11-11
Posts: 4,548
Website GitHub

Re: breakform and breakby

Myusername wrote #331026:

Am I wrong to think the result must be this?

It should be this, for consistency, but is a bit cumbersome to implement. Since nobody asked (until now :-) we have left it as it was before breakform introduction. One day, perhaps…

With break it worked perfectly, but I need more than just a div, so I’m trying breakform.

If your break does not require to be parsed, you can use <+> pattern:

<txp:article form="default" breakby="1, 1, 3"
    break="<div> and more <+></div>" />

Offline

#3 2021-07-20 20:27:15

etc
Developer
Registered: 2010-11-11
Posts: 4,548
Website GitHub

Re: breakform and breakby

etc wrote #331028:

One day, perhaps…

This day has come.

Offline

#4 2021-07-21 05:10:42

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

Re: breakform and breakby

That’s a very cool day!


Patrick.

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

Offline

#5 2021-07-21 07:13:21

Myusername
Member
Registered: 2019-12-12
Posts: 141

Re: breakform and breakby

Nice. Looking forward to seeing this thing in action :D

Offline

#6 2021-07-21 09:51:05

etc
Developer
Registered: 2010-11-11
Posts: 4,548
Website GitHub

Re: breakform and breakby

Myusername wrote #331069:

Nice. Looking forward to seeing this thing in action :D

It could be

<txp:article breakform="article-break" breakby="1, 1, 3" limit="5" />

<!-- article-break -->
<txp:variable name="class_1" value="one" />
<txp:variable name="class_2" value="another_one" />
<txp:variable name="class_3" value="three" />

<div class="<txp:variable name='class_<txp:yield item="count" />' />">
<+>
</div>

Offline

#7 2021-07-21 11:55:50

Myusername
Member
Registered: 2019-12-12
Posts: 141

Re: breakform and breakby

I did some tests, and that’s pretty good. Thanks

Offline

#8 2021-07-21 20:09:50

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,188
Website

Re: breakform and breakby

Myusername wrote #331071:

I did some tests, and that’s pretty good. Thanks

Agree, that’s a clever idea!


TXP Builders – finely-crafted code, design and txp

Online

Board footer

Powered by FluxBB