Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-10-20 20:50:53

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Image categories on non-default page

Run into a small problem with a site I am working on. Am looking to create an image gallery using the if_category tags.

Basically, something like this:

  1. News images
  2. Sports images
  3. Family images

Those would be the side links, on a page called “Photos”.

By clicking on one of the links, the user should stay on the “Photos” page, and the images from the particular set should display.

The if_category tag uses the default page, which is no good in this case. I looked at the cbs_category_list plugin, but that only supports article type, not image type.

Ideas?

Offline

#2 2008-10-20 21:02:21

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

Re: Image categories on non-default page

Wouldn’t this do what you want?

<txp:category_list type="image" section="photos" />

(or this_section="1").
I’m assuming now that ‘photos’ is a section as well as a page. Not sure how you would use if_category though…

Offline

#3 2008-10-20 21:36:32

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

Re: Image categories on non-default page

It’s not the <txp:if_category> tag itself that uses the default section, it’s that by default the category links themselves point to the default section unless you modify them. Using Els’ code above will keep the listing within the “photos” section so you need to add the <txp:if_category> tags to the page template used by that section to output the resulting list the way you want it.


Stuart

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

Offline

#4 2008-10-21 19:24:51

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Image categories on non-default page

Thanks Els and Stuart. I was missing the obvious… Late night coding :-(

Funny thing is, I had this already on the same page: ;-)

<txp:category_list section="photos" break="br" exclude="Article-images,Retired,site-design,slideshow" type="image" wraptag="p" />

Making the image gallery work is quite simple I think, but one needs 4.07 or asy_wondertag to make it work (never used it, and prefer not to start since 4.07 is around the corner).

Sample code:

<h2>Images from the <txp:category title="1" type="image" /> category:</h2>
<div id="large-image"><txp:wet_for_each_image category="<txp:category type="image" />">
<txp:upm_image form="large_images" image_id="{id}" type="image" />
</txp:wet_for_each_image></div>

The <txp:category /> could pull the image category name out dynamically, which would be perfect. I’ll try it out with 4.07…

Offline

#5 2008-10-21 20:47:43

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

Re: Image categories on non-default page

Try the SVN. It’s pretty stable and has the odd new tag you could practice with. ;)


Stuart

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

Offline

#6 2008-10-21 20:57:01

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Image categories on non-default page

Hi Stuart. I did just that, because I prefer to try out the new version and learn the new tags. Its great!

And – I already created a full image gallery, using TXP tags, jQuery slideshow and thumbnails, upm_image and wet_for_each_image. What’s nice is that the side menu lists the image categories and clicking on a link brings up the images in that particular category.

4.07 really makes a huge difference – creating menus will be so much easier and the new parsing engine – fantastic.

When the site is live I will post the code on TXP Tips.

Offline

#7 2008-10-21 20:57:22

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

Re: Image categories on non-default page

Jonathan, if I’m not mistaken wet_for_each_image will use the current category if you leave out the category attribute.

Offline

#8 2008-10-21 21:06:25

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Image categories on non-default page

You are quite correct Els :-) Makes the code a little cleaner! Thanks.

Offline

Board footer

Powered by FluxBB