Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-05-23 16:22:41

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

<txp:images> usage

Quick question:

Is there a better/more streamlined way to write this code below? The wiki page on the <txp:images /> tag seems to be missing some examples of usage as a container tag at the moment so can you confirm this is OK…

<ul id="gallery">
<txp:images sort="id asc" category="gallery">
<li><img src="<txp:image_url />" alt="<txp:image_info type='alt' />"></li>
</txp:images>
</ul>

Cheers, Phil

Offline

#2 2011-05-23 16:32:52

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

Re: <txp:images> usage

Is there a better/more streamlined way to write this code below?

Did you try

<txp:images sort="id asc" category="gallery" html_id="gallery" wraptag="ul" break="li">
<img src="<txp:image_url />" alt="<txp:image_info type='alt' />" />
</txp:images>

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

Offline

#3 2011-05-23 16:52:09

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: <txp:images> usage

Thanks, but I need an id on the <ul> tag so don’t want to use wraptag, I was just unsure of whether I could use the following…

<ul id="gallery">
<txp:images sort="id asc" category="gallery" break="li">
<txp:image />
</txp:images>
</ul>

…and it seems you can. Just tested and it’s fine.

Last edited by philwareham (2011-05-23 16:59:42)

Offline

#4 2011-05-23 17:08:41

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: <txp:images> usage

txp:images: “The HTML id attribute applied to the wraptag, if set, otherwise to the img tag.”

Last edited by GugUser (2011-05-23 17:09:21)

Offline

#5 2011-05-23 17:16:21

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

Re: <txp:images> usage

Hi Phil, this might be even more streamlined

<txp:images sort="id asc" category="gallery" html_id="gallery" wraptag="ul" break="li">
<txp:image />
</txp:images>

and it’ll do the same as your code above


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

Offline

#6 2011-05-23 17:21:00

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: <txp:images> usage

Oh, never noticed the html_id attribute before, thanks for the heads-up.

Offline

#7 2011-06-17 08:16:19

ricoschette
Member
From: Estonia
Registered: 2005-09-17
Posts: 176

Re: <txp:images> usage

I am posting here my question about using this tag.
<txp:images category=“portfolio” thumbnail=“0” />

I have a gallery that doesn’t have thumbnails.
I want to display large images.
Can it be done with this tag?
If I use thumbnail=“0” then nothing shows up.

Offline

#8 2011-06-17 08:29:32

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: <txp:images> usage

@ricoschette

How about…

<txp:images sort="id asc" category="portfolio" break="p" thumbnail="0"><txp:image /></txp:images>

Offline

#9 2011-06-17 08:44:52

ricoschette
Member
From: Estonia
Registered: 2005-09-17
Posts: 176

Re: <txp:images> usage

Thanks, philwareham.
But for some reason no images show up. Source code shows nothing.

EDIT:
I removed “thumbnail=“0”“ and it works!
YES!

Last edited by ricoschette (2011-06-17 08:46:24)

Offline

#10 2011-06-17 09:05:31

ricoschette
Member
From: Estonia
Registered: 2005-09-17
Posts: 176

Re: <txp:images> usage

Well, actually I do have thumbs.

But for displaying thumbs I have another tag :)
Thumbs are generated into another div.

My code:

<div id=“slidePrev” class=“prev”></div>
<div class=“large-image”> <div id=“slider”> <div id=“slidesContainer”> <txp:images sort=“id asc” category=“portfolio”><txp:image /></txp:images> </div> </div>
</div>
<div id=“slideNext” class=“next”></div>
<div class=“sliderGallery”> <div class=“thumbs-wrap”> <txp:images sort=“id asc” category=“portfolio” thumbnail=“1” break=“li” wraptag=“ul” class=“no-class”> <a href=”#”><txp:image_url link=“0”><txp:thumbnail /></txp:image_url></a> </txp:images> </div> <div class=“slider”> <div class=“handle”></div> </div>
</div>

Last edited by ricoschette (2011-06-17 09:09:42)

Offline

#11 2011-06-17 09:09:39

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: <txp:images> usage

Ah, the textbook entry for <txp:images /> states that:

thumbnail=“boolean”
Filter the image list to only include images that have a thumbnail (1) or not (0).

That means you original code was only going to include images that do not have a thumbnail associated with them and ignore all others.

Offline

#12 2011-06-17 09:11:38

ricoschette
Member
From: Estonia
Registered: 2005-09-17
Posts: 176

Re: <txp:images> usage

Right.

See my previous post for code.
Not sure if it can be done any shorter.

Offline

Board footer

Powered by FluxBB