Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-01-09 10:40:14

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Use of txp:image_index and txp:image_display tags

I usually have no problem understanding txp tags, after one or two tries everything becomes clear. But in this case I’m lost.

I’ve read somewhere in this forum that it’s possible to display a list of thumbnails in an article with txp:image_index, so that when clicking on one, the image displayed with txp:image_display changes, without changing the article.

I have this simple code inside the article body:

<txp:image_index c="artdeco" />

The images belong to an images-only category, specified in the image_index tag. I’ve tried to put the image_display tag outside of any context in the page (inside the header for example). The image is displayed, but the article is not. And as noted in Textbook, putting the tag inside the article context doesn’t work.

In fact, I don’t understand how TXP uses the url to display the image, there seems to be some pagination involved (example: ?c=artdeco&p=3 in the url).

Last edited by PascalL (2010-01-09 19:31:04)

Offline

#2 2010-01-09 12:39:36

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Use of txp:image_index and txp:image_display tags

It’s been ages since I looked at using these tags, probably before we had any gallery-type plugins available, but I’m pretty sure that the article has to be in the same category as the images so if you are using an “images-only” category then that may be the reason it isn’t working for you. Not sure if that helps. And yes, I know what it says in TextBook but I’m not sure it is totally correct. As you say, the category becomes part of the URL which leads my feeble brain to think that the article has to be in that category as well. Naturally I’m open to correction on that. It has been a while.

Last edited by thebombsite (2010-01-09 12:45:10)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2010-01-09 13:36:26

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: Use of txp:image_index and txp:image_display tags

Thanks Stuart!

I tried to use the same category for articles and images.
It works only if I don’t put the image:display tag inside the article body, but in the form or page. I thought all txp tags could be used inside articles.

But…

This way, I can only display a gallery in the context of a category listing. Individual articles do not refer to category in the url, therefore the gallery doesn’t display.

What’s the use of an image listing along an article list ? Can someone point me to a real use case or suggest some possible uses? Here’s my rough working category page, but again, I don’t see why do something like that.

What I’m trying is to have an image list inside an individual article. If that can’t be done with these tags, I’ll look into other solutions. But before that, and it’s the most important part, I need to understand how to work with the txp native tags and what can be achieved with them.

Last edited by PascalL (2010-01-09 13:45:57)

Offline

#4 2010-01-09 14:22:20

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,454
Website GitHub

Re: Use of txp:image_index and txp:image_display tags

PascalL wrote:

I need to understand how to work with the txp native tags and what can be achieved with them.

As far as I’m concerned, image_index and image_display are abominations and should be shot. I don’t know anybody (besides you at this moment!) that uses them and if I have my way I’d like to deprecate them from the next release and replace them with some more powerful — and far more TXPish — alternatives. At the moment, a plugin really is the simplest and best way to make an image gallery.

Just saying this so you don’t get too comfy with the native tags :-)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2010-01-09 14:51:20

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: Use of txp:image_index and txp:image_display tags

Please, don’t remove these tags. Improve them.

I felt the need of making my own plugin out of them, because the concept was brilliant for non-javascript galleries. That way, you could have a gallery inside a page, changing main image without changing the article listing below. Or, You can have a gallery section without an article. That can’t be achieved in other ways with non-js galleries.

Maybe it’s a minority scenario, but it’s worth keeping. They only lack some more attributes and maybe a sort of reworking. I didn’t know they don’t work inside articles. I can only say they should… :)

Offline

#6 2010-01-09 15:38:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,454
Website GitHub

Re: Use of txp:image_index and txp:image_display tags

Zanza wrote:

Please, don’t remove these tags. Improve them.

OK, I didn’t know you could use them like that. Makes sense to leave them. I could never get them working and it seemed totally counter-intuitive to the way TXP works!

But since I can’t actually get them to work, I’ve got no chance improving them so I’ll just leave that bit to someone else.

I will however be adding some tags that work more like a gallery should behave in TXP (e.g. <txp:image_list category="some_cat" wraptag="ul" break="li" form="my_gallery_layout" />).

you could have a gallery inside a page, changing main image without changing the article listing below. Or, You can have a gallery section without an article.

Would you mind sharing some code examples of these two scenarios? I don’t get it (sorry!)

Last edited by Bloke (2010-01-09 15:40:39)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2010-01-09 16:12:33

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Use of txp:image_index and txp:image_display tags

I just tested the use of both tags inside an article, and with one small modification it can work. The reason it doesn’t at the moment is that, when clicking a thumbnail, the url changes from site.com/section-name/article-title-or-id to site.com/section-name/?c=cat-name&p=pic-id. When you manually add the article id or title to the url (like this: site.com/section-name/article-title-or-id/?c=cat-name&p=pic-id) the article, thumbnail list and full image are all displayed.
Don’t know much about coding, but wouldn’t it be possible to change the tag’s code so that the ?c=cat-name&p=pic-id is added after the current url?

Does this make sense at all?

Last edited by els (2010-01-09 16:13:08)

Offline

#8 2010-01-09 19:24:24

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: Use of txp:image_index and txp:image_display tags

As far as I’m concerned, image_index and image_display are abominations and should be shot.

and it would make me an accomplice of such an irremediable act?! :D

Or, You can have a gallery section without an article.

Thanks Zanza, I didn’t thing about this possibility. At least this makes sense.
Again, adding an article list after this gallery isn’t very useful IMHO.

Please, don’t remove these tags. Improve them.

I agree, there is room for improvement!
The idea behind is useful: a non-javascript gallery which displays images without changing the page you’re viewing (except the image of course).
I like the idea of placeholders, image_display is one. The new yield tag is another.
As Els said, there’s some url cooking to do here to make it work inside an article. Also, I would really like to use the tags without syncing article and image categories. In my view, these are totally different things I don’t want to mix.

Of course, Bloke, your tag proposal makes a lot of sense for most common uses, I’m very glad you’re working on improvements for image display in Txp !

Last edited by PascalL (2010-01-09 19:29:41)

Offline

#9 2010-01-09 21:03:53

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: Use of txp:image_index and txp:image_display tags

Would you mind sharing some code examples of these two scenarios? I don’t get it (sorry!)

Just tried a gallery section in my personal sandbox, as Zanza suggested. Sorry for the mess, this is just a sandbox.

<div id="contenu">

<txp:article /><!--there's no article anyway-->

<h2>Galerie</h2>
<txp:image_index c="artdeco" wraptag="ul" break="li" /><br />
<txp:image_display />

</div><!--fin contenu-->

The article tag seems necessary to stop Txp complaining. That’s all.

Last edited by PascalL (2010-01-09 21:05:26)

Offline

#10 2010-01-09 21:19:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,454
Website GitHub

Re: Use of txp:image_index and txp:image_display tags

PascalL wrote:

Just tried a gallery section in my personal sandbox

Thanks PascalL. Never realised that was the point of the tags; learn something new every day, eh?!

So I take back what I said about the tags earlier. They can live :-)

Regarding the messy URL syntax and broken article support, I wonder if these tags came very early on before clean URLs? I wasn’t around back then, so it’s only a guess. Perhaps if you choose messy mode, the image_index links work inside an article? Don’t know.

Sadly, TXP only understands one type of ?c in the URL — the article category — so the two categories do have to be synced for the tags to work. Not sure if it’s possible to separate them. I could take a look one day…


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#11 2010-01-09 21:33:33

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: Use of txp:image_index and txp:image_display tags

So I take back what I said about the tags earlier. They can live :-)

pfff, that was close! now I can relax with the feeling I just saved something’s life ! :D

Regarding urls, I desactivated gdb_permanent_links because it seemed harder to get something working. I’ll try now to reactivate. And I’ll try your suggestion with messy urls too. That might give some insight on what the tag does. Thanks!

Last edited by PascalL (2010-01-10 10:33:22)

Offline

#12 2010-01-09 22:57:25

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Use of txp:image_index and txp:image_display tags

Stef – these tags have been around at least since the gamma days when Dean was still doing the development and it’s that long since I used them myself which is why their use is a little fuzzy to me. Indeed I’m pretty sure we were still using the old place-holder files pre .htaccess days so thus I believe pre “clean” URLs. As far as I’m aware they haven’t been changed since then so maybe a bit of updating wouldn’t go amiss. There would certainly be a good case for keeping a non-javascript method of creating a gallery of sorts.

There’s probably a post in the archives somewhere announcing their arrival.

Last edited by thebombsite (2010-01-09 23:01:22)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

Board footer

Powered by FluxBB