Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-11-27 10:11:21

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

Do I use <txp:yield> correctly?

On this page I’m using a slider. It does work … for a bit. But it doesn’t jump from image 5 to 1 or from 1 to 5. And I’m guessing it’s because I don’t use the <txp:yield> tag correctly.

Form (slider):

<div class="flexslider">
<txp:images id='<txp:yield name="id" />' wraptag="ul" break="li" class="slides">
<img loading="lazy" src='<txp:smd_thumbnail type="800"><txp:smd_thumbnail_info item="url" /></txp:smd_thumbnail>' alt='<txp:smd_thumbnail_info item="alt" />' srcset="<txp:smd_thumbnail type="400"><txp:smd_thumbnail_info item="url" /> 400w</txp:smd_thumbnail>, <txp:smd_thumbnail type="800"><txp:smd_thumbnail_info item="url" /> 800w</txp:smd_thumbnail>, <txp:smd_thumbnail type="1200"><txp:smd_thumbnail_info item="url" /> 1200w</txp:smd_thumbnail>, <txp:smd_thumbnail type="1600"><txp:smd_thumbnail_info item="url" /> 1600w</txp:smd_thumbnail>" sizes="(max-width: 640px) calc(100vw - 30px), (max-width: 1024px) 52.33vw, (max-width: 1440px) 50.33vw, 708px"/>
</txp:images>
</div>

[edit]
I saw image 5 didn’t have the correct smd_thumbnail(s). Now it has and the slider is working fine … :)

In article:

<txp::slider id="137, 135, 139, 31, 110" />

Am I right?

Last edited by RedFox (2019-11-27 11:45:21)

Offline

#2 2019-11-27 11:19:53

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

Re: Do I use <txp:yield> correctly?

It looks like you’ve used it just right to me.

On your page it does jump from 5 to 1 or from 1 to 5 but your last image is lacking a src / srcset and that may be the problem you’re seeing. The page source just shows a load of commas and spaces.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2019-11-27 11:47:04

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

Re: Do I use <txp:yield> correctly?

Yes, that’s correct. I saw image 5 didn’t have the right smd_thumbnails. Now it has and the slider works fine … :)

Last edited by RedFox (2019-11-27 14:16:07)

Offline

Board footer

Powered by FluxBB