Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-05-22 12:20:44

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

[SOLVED] clear div after every 2 divs

This should be simple but I’m still head-scratching. At the moment, I am using the following code

<txp:images category="cite" limit="999" sort="alt desc" break="">
<div class="grid_12 grideven"><figure itemscope itemtype="http://schema.org/ImageObject">
<span itemprop="image" class="grid_7 alpha"><img src="<txp:site_url />images/<txp:image_info type="id" />t<txp:image_info type="ext" />" alt="<txp:image_info type="alt" />" title="<txp:image_info type="alt" />" width="<txp:image_info type="thumb_w" />" height="<txp:image_info type="thumb_h" />" /></span>
<figcaption itemprop="caption" class="grid_17 omega"><txp:image_info type="caption" escape="" />
</figcaption></figure>
<div class="clear">&nbsp;</div>
</div>
</txp:images>

Is there a way to have a <div class="clear">&nbsp;</div> after every second div parsed?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2019-05-22 12:38:47

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,529
Website GitHub Twitter

Re: [SOLVED] clear div after every 2 divs

Hi,

there was a plugin from zem : zem_nth, if you couldnt find it i can past it here.

Cheers.

Offline

#3 2019-05-22 12:54:38

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: [SOLVED] clear div after every 2 divs

Have you tried

<txp:images breakby="2" break="<div class='clear'>&nbsp;</div>" ... />

combination?

Offline

#4 2019-05-22 12:54:51

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: [SOLVED] clear div after every 2 divs

Gocom’s fork of zen_nth

See also: txp:article_custom odd and even for a plugin-free solution using if_variable from etc

Offline

#5 2019-05-22 16:20:13

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: [SOLVED] clear div after every 2 divs

etc wrote #318164:

Have you tried

<txp:images breakby="2" break="<div class='clear'>&nbsp;</div>" ... />...

combination?

That was exactly what I was trying to figure out but managed to fall into the old single/double quotes trap which was breaking the layout. Thanks so much Oleg.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB