Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2021-07-16 21:11:21
- Myusername
- Member
- Registered: 2019-12-12
- Posts: 162
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
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 tryingbreakform
.
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
Offline
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: 162
Re: breakform and breakby
Nice. Looking forward to seeing this thing in action :D
Offline
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: 162
Re: breakform and breakby
I did some tests, and that’s pretty good. Thanks
Offline
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
Offline
Pages: 1