Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-12-18 05:24:17

pauldob
New Member
Registered: 2012-12-17
Posts: 3

list only sub-category names and images of a category

Hi,
Anyone know any way to display only a category’s sub-category names and their images. For example image category ‘web’ has sub-categories ‘sport’ and ‘leisure’, I want to display each category name and it images so i see name, images, name, images …. etc.

anyone any clues?

Thanks
Paul

Offline

#2 2012-12-18 09:36:49

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: list only sub-category names and images of a category

This should work. If not have a look here

<txp:category_list parent="web" exclude="web" type="image"  />

Offline

#3 2012-12-19 09:15:39

pauldob
New Member
Registered: 2012-12-17
Posts: 3

Re: list only sub-category names and images of a category

Hi redbot,
Thanks for your reply. The tag only displays the categoriy names, not the images in that category. I’m using smd_gallery plugin to get the images on screen, if anything i suppose its the plugin that would solve it…
Thanks again
Paul

Offline

#4 2012-12-19 09:26:31

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

Re: list only sub-category names and images of a category

pauldob wrote:

the images in that category

You can use <txp:category_list> as a container tag so you can then do something with each matching category. Like this (untested):

<txp:category_list parent="web" exclude="web" type="image">
   <h2>Images in <txp:category title="1" /></h2>
   <txp:images category='<txp:category />'>
      <txp:thumbnail wraptag="div" class="thumb" />
      <txp:image_info wraptag="span" class="caption" />
   </txp:images>
</txp:category_list>

Alternatively you can defer the contained content to a form using the form attribute if you intend to re-use it somewhere else. The good news is that you shouldn’t need smd_gallery for this: you can put in whatever standard markup and txp tags you want to obtain the desired effect, e.g. click-to-view fullsize, hover to show fullsize, a gallery jQuery plugin…

Hope that helps.

Last edited by Bloke (2012-12-19 09:29:02)


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 2012-12-20 05:45:10

pauldob
New Member
Registered: 2012-12-17
Posts: 3

Re: list only sub-category names and images of a category

Stef,
Thanks for that it worked a treat, thanks for the mail also.

Regards
An appreciative txp user!

Offline

Board footer

Powered by FluxBB