Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-06-07 22:01:54
- carrotrope
- Member
- From: Edinburgh
- Registered: 2007-03-16
- Posts: 39
Automatically render all images in a category?
Hi all,
I’m making a portfolio website for a friend with TXP. They have six main categories of work (collage, drawing, etc) and I want them to be able to upload images into specific image categories and have all of those images be automatically rendered (eg. just spit out <img src=“etc.jpg”><img src=“etc.jpg”><img src=“etc.jpg”> etc.) on six pages, without the need for posting new articles linked to those images. Is this possible?
I’ve downloaded and installed both wet_for_each_image and upm_image but have no idea if these are the correct plugins to be using, and if they are, just how to make them achieve this?
Any help appreciated! Thanks!
Jez
Offline
Re: Automatically render all images in a category?
carrotrope wrote:
all of those images be automatically rendered… on six pages, without the need for posting new articles linked to those images.
Have you tried smd_gallery? It might be overkill but it might help.
Here are also a couple of avenues for exploration, neither of them tested:
<txp:category_list type="image">
<txp:smd_gallery category='<txp:category />' />
</txp:category_list>
That renders all galleries on one page. You can use trickery or some of the onchange
filtering ability to add headings when the category changes.
Or perhaps a two-tier approach. In your article list/sidebar:
<txp:category_list type="image">
<a href="<txp:site_url />gallery?cat=<txp:category />"><txp:category title="1" /></a>
</txp:category_list>
And then in the Form that handles the gallery
Page, add this in the flow somewhere:
<txp:smd_gallery category="?cat" />
That reads the URL variable passed from the category_list and renders the images from it. You can of course employ smd_if or other plugins around it to check that the category exists / catch malformed URLs.
Does any of that help?
Last edited by Bloke (2009-06-07 22:25:35)
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
Online
#3 2009-06-07 23:01:39
- carrotrope
- Member
- From: Edinburgh
- Registered: 2007-03-16
- Posts: 39
Re: Automatically render all images in a category?
Hi Stef,
The first one works brilliantly, but is there any way that the images can’t each be hyperlinked to the file? I just need the images and nothing else..
Jez
Offline
Re: Automatically render all images in a category?
carrotrope wrote:
The first one works brilliantly, but is there any way that the images can’t each be hyperlinked to the file?
Cool, well the default form in smd_gallery renders the images and links them, because usually you would use a lightbox or something to view the full size pics. If you don’t like the hyperlink, use your own gallery form or use smd_gallery as a container and write your own markup inline, like this:
<txp:category_list type="image">
<txp:smd_gallery category='<txp:category />'>
<txp:image id="{id}" />
</txp:smd_gallery>
</txp:category_list>
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
Online
#5 2009-06-07 23:25:07
- carrotrope
- Member
- From: Edinburgh
- Registered: 2007-03-16
- Posts: 39
Re: Automatically render all images in a category?
Awesome! Thanks so much.
Sorry, just one last query. I’m trying to sort the images in order of the order they were uploaded, but both of the options I’m trying below give the same output.. do I have the formatting wrong? Or am I using the wrong term?
<txp:smd_gallery category=“collage” form=“show” sort=“desc” />
<txp:smd_gallery category=“collage” form=“show” sort=“asc” />
Offline
Offline
#7 2009-06-08 00:12:24
- carrotrope
- Member
- From: Edinburgh
- Registered: 2007-03-16
- Posts: 39
Re: Automatically render all images in a category?
Thanks so much! Perfect.
Offline