Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Making a slider gives error ... !? (Solved: typo ... :o)
The form:
<txp:images class="main-carousel" id="<txp:yield name="id" />" wraptag="ul" break="" data-flickity='{ "cellAlign": "left", "contain": true }'>
<li class="carousel-cell">
<figure>
<img src='<txp:smd_thumbnail type="720"><txp:smd_thumbnail_info item="url" /></txp:smd_thumbnail>' alt='<txp:smd_thumbnail_info item="alt" />' srcset='<txp:smd_thumbnail id='<txp:yield name="id" />' type="360"><txp:smd_thumbnail_info item="url" /> 360w</txp:smd_thumbnail>, <txp:smd_thumbnail id='<txp:yield name="id" />' type="720"><txp:smd_thumbnail_info item="url" /> 720w</txp:smd_thumbnail>, <txp:smd_thumbnail id='<txp:yield name="id" />' type="1080"><txp:smd_thumbnail_info item="url" /> 1080w</txp:smd_thumbnail>, <txp:smd_thumbnail id='<txp:yield name="id" />' type="1440"><txp:smd_thumbnail_info item="url" /> 1440w</txp:smd_thumbnail>'
sizes="(min-width: 1280px) 635px, (min-width: 1000px) calc(43.85vw + 83px), (min-width: 760px) 680px, calc(95.45vw - 26px)" />
</figure>
</li>
</txp:images>
The error:
Tag error: <txp::slider id="1, 2, 3" /> -> Textpattern Warning: Tag opening/closing mismatch: <txp:images class="main-carousel" id='<txp:yield name="id" />' wraptag="ul" data-flickity='{ "cellAlign": "left", "contain": true }'>…</txp:smd_thumbnail>. while parsing form slider on page activiteiten
Tag error: <txp::slider id="1, 2, 3" /> -> Textpattern Warning: Closing tag without corresponding opening tag: </txp:images>. while parsing form slider on page activiteiten
Last edited by RedFox (2025-03-17 20:03:52)
Offline
Re: Making a slider gives error ... !? (Solved: typo ... :o)
Glad you found your typo. I think you can probably simplify things quite a bit more, though. As far as I recall, if you use smd_thumbnail inside txp:images, it will automatically use the current image id of the loop, so you don’t need to additionally specify it using txp:yield… (I think in your example, txp:yield… would also have multiple values).
Also, does txp:images correctly add the data attribute to the bounding ul tag? I didn’t know txp:images could do that. In my example below, I just added it as a separate wrapping ul
. And finally, you need to use single quotes where you have a txp-tag as an attribute of a txp-tag (so for your first id
in txp:images
), but you don’t need single quotes if they are just attributes of a regular html tag.
The following is untried, but I think this should also work:
<ul class="main-carousel" data-flickity="{ 'cellAlign': 'left', 'contain': true }">
<txp:images id='<txp:yield name="id" />' wraptag="" break="">
<li class="carousel-cell">
<figure>
<img src="<txp:smd_thumbnail type="720" format="url" />"
alt="<txp:smd_thumbnail_info item="alt" />"
srcset="<txp:smd_thumbnail type="360" format="url" /> 360w,
<txp:smd_thumbnail type="720" format="url" /> 720w,
<txp:smd_thumbnail type="1080" format="url" /> 1080w,
<txp:smd_thumbnail type="1440" format="url" /> 1440w"
sizes="(min-width: 1280px) 635px,
(min-width: 1000px) calc(43.85vw + 83px),
(min-width: 760px) 680px,
calc(95.45vw - 26px)"
>
</figure>
</li>
</txp:images>
</ul>
TXP Builders – finely-crafted code, design and txp
Offline
Re: Making a slider gives error ... !? (Solved: typo ... :o)
Thanks Jacob … :)
Offline