Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2012-08-30 15:26:55

etc
Developer
Registered: 2010-11-11
Posts: 3,123
Website

Re: Group article two by two

You are using wrong selectors: either wrap the content of slide form in <article> tag, or replace query="//article[position() mod 2=1]" by

query="//div[@class='product-big'][position() mod 2=1]"
and {following-sibling::article[1]} by {following-sibling::div[1]}.

Edit: and check if {following-sibling::div[1]} is well wrapped in braces, your code lacks the opening one.

Last edited by etc (2012-08-30 15:31:37)


etc_[ query | search | pagination | date | tree | cache ]

Offline

#12 2012-08-30 15:52:58

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: Group article two by two

Thanks! Everything works!

Offline

#13 2012-08-30 16:03:01

milosevic
Member
From: Madrid, Spain
Registered: 2005-09-19
Posts: 387

Re: Group article two by two

I will use a simple article custom and for take control of the presentation a variable and adi_calc


<txp:rocks/>

Offline

#14 2012-08-30 18:19:19

etc
Developer
Registered: 2010-11-11
Posts: 3,123
Website

Re: Group article two by two

milosevic wrote:

I will use a simple article custom and for take control of the presentation a variable and adi_calc

I’ve made some testing, with 10 articles:

  • Bare article_custom (without grouping): ~0.014s
  • Gocom offset solution: ~0.019s
  • Uli/wet zebra: ~0.02s, roughly equivalent to what you suggest.
  • etc_query solution: ~0.017s

Conclusion: they all take the same time, but etc_query has much shorter code.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#15 2019-04-15 13:14:27

etc
Developer
Registered: 2010-11-11
Posts: 3,123
Website

Re: Group article two by two

In 4.7 the formal OP problem can be solved via breakby attribute:

<txp:article breakby="2" break="div" breakclass="group">
    <article id="<txp:article_id />" />
</txp:article>

etc_[ query | search | pagination | date | tree | cache ]

Offline

Board footer

Powered by FluxBB