Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-03 21:20:54

Morgon
Member
From: Selmer, Tennessee
Registered: 2004-12-01
Posts: 23
Website

Making a list of article images in a sidebar

I’m working on a 3-column layout. The main article body will be in the center, and there will be some author information in the left column. Now, I would like to have an “Article gallery” in the right sidebar, which would list all the images that go along with that article as thumbnails, and then use the Lightbox JS 2.0 script to pop the images up. I’m trying to use a plugin that will allow more than one article image and thumbnails. I’ll most likely have between 2-8 photos per entry.

I was trying to use the hak_article_thumb tag for this, but I’m running into two problems.

1. In order to use the Lightbox JS script, the links need to have an rel attribute of “lightbox” – <a href="#" rel="lightbox">. Is there a way to add an attribute to the automatically generated thumbnail link, even if it means using a different plugin?

2. The hak_article_thumb tag is working fine, as long as it’s called from within the entry’s body. If I try and include it in a template, it just won’t work. I’m assuming that this is normal behaviour, and not a bug.

So, does anyone have suggestions for me on how to accomplish this?

Offline

#2 2006-04-04 14:45:10

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

Re: Making a list of article images in a sidebar

1. If the plugin is working for you otherwise, I’d try modifying the plugin code to do this. You could ask in the plugin thread if you don’t know how. But there may be plugins that suit your needs better.

2. That’s right. I’m not familiar with the plugin, but I assume it can be used in an article form. You can have a second article tag in the sidebar using a separate article form that contains the hak_article_thumb tag, something like
<code>
<txp:if_individual_article>
<txp:article form=“hak_article_thumb” />
</txp:if_individual_article>
</code>
(If you do this, turn ‘automatically append comments to articles’ off!)

Offline

#3 2006-04-04 15:56:52

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: Making a list of article images in a sidebar

hak_article_image uses TXP’s built in thumbnail function which won’t accept the rel attribute.

My recommendation would be to use upm_article_image which is part of upm_img_popper. It does pretty much everything hak_article_image does (It might lack one or two things but the main stuff is there), and it allows you to specify an output_form for the image so you can build the tag however you want.

This is what I wanted to do with the next version of hak_article_image but Mary beat me to it so might as well use her hard work.


Shoving is the answer – pusher robot

Offline

#4 2006-04-04 16:44:54

Morgon
Member
From: Selmer, Tennessee
Registered: 2004-12-01
Posts: 23
Website

Re: Making a list of article images in a sidebar

Thanks so much. You’re help is invaluble. I’ll post back when I get it working, to follow this thread up to the conclusion.

Offline

#5 2006-04-05 17:16:20

Morgon
Member
From: Selmer, Tennessee
Registered: 2004-12-01
Posts: 23
Website

Re: Making a list of article images in a sidebar

Well, I’m having a bit of trouble. (of course! :) ) I’ve got this partially working, but am running into one problem.

I’m using the following code for my template in the area I want the thumbnails to go:

<code><txp:if_individual_article>
<txp:article form=“entry_gallery” />
</txp:if_individual_article></code>

And the “entry_gallery” form is:

<code><txp:upm_article_image type=“thumbnail” form=“upm_article_image” /></code>

And the “upm_article_image” form is:

<code><a href=”<txp:upm_img_full_url />” rel=“lightbox”><txp:upm_article_image type=“thumbnail” /></a></code>

Now, I have three images assigned to the article (by ID numbers seperated by commas in the Article Image field). The result that I“m ending up with is three sets of thumbnail images, with 1 link per set, though the links are correct. Sort of like this:

<code><a href=“link to image 1”>
<img src=“thumb 1” />
<img src=“thumb 2” />
<img src=“thumb 3” />
</a>

<code><a href=“link to image 2”>
<img src=“thumb 1” />
<img src=“thumb 2” />
<img src=“thumb 3” />
</a>

<code><a href=“link to image 3”>
<img src=“thumb 1” />
<img src=“thumb 2” />
<img src=“thumb 3” />
</a></code>

I can’t figure out how to display a thumbnail linked to the full size version, and have one of each subsequent image. If I try and use the “limit” or “offset” attributes for the upm_article_image tag, then I solve the set-of-thumbnails problem, but I only get the same thumbnail three times in a row.

I’m looking to make a list of the thumbnails of all article images, and have the ability to modify the <a> tags so that I can use the Lightbox JS script (by adding a rel="lightbox" attribute to the link tag).

Offline

#6 2006-04-05 18:35:49

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: Making a list of article images in a sidebar

Do this in your upm_article_image_form

<a href="<txp:upm_img_full_url />" rel="lightbox"><img src="<txp:upm_img_thumb_url />" width="<txp:upm_img_thumb_width />" height="<txp:upm_img_thumb_height />" /></a>

Should give you what you are looking for. The way you have it you are calling the upm_article_image function inside your article_image form so it’s pulling all the images in for each image (which is why you get the three images inside each link)


Shoving is the answer – pusher robot

Offline

#7 2006-04-05 18:45:52

Morgon
Member
From: Selmer, Tennessee
Registered: 2004-12-01
Posts: 23
Website

Re: Making a list of article images in a sidebar

Awwwwwww Geez! :)

I knew it was going to be simple. I really should have thought of that myself, but I guess I got too close to it, eh?

Hakjoon, you’re a lifesaver… well, at least a *time*saver!

Thanks so much, it worked like a charm.

Offline

Board footer

Powered by FluxBB