Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2006-11-12 22:21:30

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: wet_for_each_image: Lists images by employing user supplied markup

Wet,
I’m glad so many folks are getting good use out of this one :)
Maybe we can all come together and post our examples? That way we could spur one another on to greater heights.

Thanks as usual man. You truly are a computer.


Offline

#12 2006-11-20 03:29:04

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,392
Website

Re: wet_for_each_image: Lists images by employing user supplied markup

Really nice plugin! One question – on your site, you have a lightbox gallery example. I used the same code for the form and it works fine, only issue is there are two br tags after each image, and I can’t see how to get the images to line up side by side, they go down from top to bottom!

Offline

#13 2006-11-20 05:15:13

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,267
Website

Re: wet_for_each_image: Lists images by employing user supplied markup

If your code is inside an article, there’s a chance that those <br /> elements are inserted by Textile. View HTML on the article edit screen, and just in case try surrounding the gallery code with <notextile>...</notextile>.

EDIT: Had a try on my site with a similar result, so this would be the reason.

Last edited by wet (2006-11-20 05:25:09)

Offline

#14 2006-11-20 16:19:35

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,392
Website

Re: wet_for_each_image: Lists images by employing user supplied markup

Thanks Robert, that worked nicely.

Offline

#15 2006-11-23 05:11:22

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: wet_for_each_image: Lists images by employing user supplied markup

Hi wet.

Very nice and easy to use plug-in.

I’m trying it, but I must admit that performance concerns me.

I’m trying to achieve a very simple thing: a list of thumbnails in the logo category (with no links, nor pop-ups nor anything else, just the thumbnail images).
I have been testing both your plug-in and this method suggested in the FAQ.

I have tried both
<txp:wet_for_each_image category="logos" thumb="1"><txp:thumbnail id="{id}" /></txp:wet_for_each_image>
and
<txp:image_index wraptag="div" break="" c="logos" />

The first one (using your plugin) makes 72 queries (total page queries), while the second one (built-in tag) just makes 46 queries (total pages queries).

The output is almost identical (both including title and alt text for all images). The only difference is that the second method (less queries) wraps the thumbnail with, for my needings, a dummy link (can’t avoid that, that’s why I tried your plug-in).

The point is: what could be making the difference in queries quantity if the output is almost the same?

Thanks!

Last edited by maniqui (2006-11-23 05:29:54)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#16 2006-11-23 05:26:22

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: wet_for_each_image: Lists images by employing user supplied markup

I add this:
I have rendered the page without any of the codes above (nor your plug-in nor the built-in tag).

It makes 45 queries. So, I conclude that the built-in tag just adds one query while the plug-in adds 27 queries.

Please, forgive me if my “benchmark” and the info given isnt very “accurate”. I’m just using my common sense to do this tests.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#17 2006-11-23 05:47:01

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,267
Website

Re: wet_for_each_image: Lists images by employing user supplied markup

Query breakup on your code would be something like that:

  • With wet_for_each_image:
    • wet_for_each_image: 1 query for the selection of images based on the criteria passed in.
    • txp:thumbnail: 1 query per image, which would amount to 27 queries for 26 thumbnails being rendered.

General rule of thumb therefore: Use internal tags as long as you can reach your design target. Plus: Txp might be improved by caching thumbnail properties, as it already does for images.

Last edited by wet (2006-11-23 05:48:09)

Offline

#18 2006-12-05 21:12:57

TNT
Member
From: Rotterdam, Netherlands
Registered: 2006-01-06
Posts: 246
Website

Re: wet_for_each_image: Lists images by employing user supplied markup

Wet,

I think this is a great plugin, but I’m wondering if I’m understanding the full potential of it completely. Therefore this question.

I’m rebuilding my site and want to use your plugin to make galleries. A single article contains a unique gallery, which contains photos of one unique category. Looking at your example using upm_image and Slimbox, I was wondering if the following will work out:

<txp:wet_for_each_image category="" sort="id asc">
<txp:upm_image form="lightbox" image_id="{id}" />
</txp:wet_for_each_image>

And the form lightbox containing a custom field:

<a rel="lightbox[<txp :custom_field name="photo-category" />]" href="<txp:upm_img_full_url />"
title="<txp:upm_img_alt escape="html" />">
<img src="<txp:upm_img_thumb_url />"
width="<txp:upm_img_thumb_width />"
height="<txp:upm_img_thumb_height />" 
alt="<txp:upm_img_alt escape="html" />"  /></a>

Thanx in advance!


Prrrrrrrr

Offline

#19 2006-12-05 21:45:26

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,267
Website

Re: wet_for_each_image: Lists images by employing user supplied markup

By using category="" you basically remove all category filters and thus select all images, which probably isn’t really what you wanted. I suppose you want to display all images belonging to the category named in custom field photo-category. In theory, you’d need one txp tag as a value for another txp tag’s attributes.

Enter asy_wondertag:

<txp:asy_wondertag>
<txp:wet_for_each_image category="<txp:custom_field name="photo-category" />" sort="id asc">
<txp:upm_image form="lightbox" image_id="{id}" />
</txp:wet_for_each_image>
</txp:asy_wondertag>

Awful nesting of brackets, isn’t it? But it works. Don’t forget to prefix the whole cod with notextile. if you enter it into an article (as opposed to using it in a form or page).

This translates to:

  1. read the contents of the current article’s custom field “photo-category”
  2. use this category name as a filter criterion for wet_for_each_image
  3. pass all matching images on to upm_image
  4. smile.

I haven’t dugg into your custom form for upm_image but it looks sensible at first glance.

Last edited by wet (2006-12-05 21:50:21)

Offline

#20 2006-12-05 22:00:56

TNT
Member
From: Rotterdam, Netherlands
Registered: 2006-01-06
Posts: 246
Website

Re: wet_for_each_image: Lists images by employing user supplied markup

Thanks for the quick reply. This is exactly what I wanted, so < ol> <li > 4 </ li> </ ol> is already in action. :-)

One last question: is this a way this plugin should be used? Or is it just a really hard way to accomplish what I want?

(Yes, that’s two questions… So I cheated :)

Last edited by TNT (2006-12-05 22:01:59)


Prrrrrrrr

Offline

Board footer

Powered by FluxBB