Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-05 02:22:23

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Display a list of download files, sortable by category

I know I can use ‘file_download_list to display a list of downloadable files by specific categories but how can I display a list and allow them to be sorted by category in the same way as articles?

ie: If I have a parent category of ‘case studies’ and 6 categories of say, ‘mining’, ‘retail’, ‘hospitality’ etc etc

I want to display them all on a page called ‘references’ but display each category list as selected.

The only way I can currently see how to do this is to have something like this;

<txp:if_category name=“mining”> <txp:file_download_list sort=“description asc” form=“files” break=“li” wraptag=“ul” category=“mining” limit=“999” /> </txp:if_category>

but, this will mean that this code would have to be added each time the client adds a new file category – not workable.

Any ideas?

Offline

#2 2009-03-05 03:05:36

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

Re: Display a list of download files, sortable by category

Try this (just copy and paste, see if it can be useful and then modify as you like).

<txp:category_list wraptag="ul" type="file" break="li" children="0" >
	<txp:category title="1" wraptag="h3"  />
	<txp:file_download_list category='<txp:category />' wraptag="ul" break="li" />
	<txp:category_list wraptag="ul" type="file" break="li" children="0" parent='<txp:category />' exclude='<txp:category />'>
		<txp:category  title="1" wraptag="h4" />  
		<txp:file_download_list category='<txp:category />' wraptag="ul" break="li"  />
		<txp:category_list wraptag="ul" type="file" break="li" children="0" parent='<txp:category />' exclude='<txp:category />'>
			<txp:category title="1" wraptag="h5"  />
			<txp:file_download_list category='<txp:category />' wraptag="ul" break="li" />
		</txp:category_list>
	</txp:category_list>
</txp:category_list>

it should work for three levels of nested categories and updated automatically as new categories are created. Hope it’s useful for your needs.

Last edited by redbot (2009-03-05 03:08:55)

Offline

#3 2009-03-05 03:19:41

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: Display a list of download files, sortable by category

Unfortunately, I’m stuck with 4.0.6 so the container tags and tags as attributes are a no go and I don’t currently have ftp access to do an upgrade either. If there’s no other solution, I’ll have to wait and get ftp access to do the u/g. Thanks for the suggestion. Any other ideas?

Offline

#4 2009-03-05 03:29:05

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

Re: Display a list of download files, sortable by category

damienbuckley wrote:

…Any other ideas?

No, sorry.
I can only suggest you upgrade soon because 4.0.8 has really some awesome features which let you do things that were just impossible before.

Offline

#5 2009-03-05 03:38:00

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: Display a list of download files, sortable by category

Yeah, tell me about it – I’m happily using 4.0.8 and all of its new features in my current builds. This is a site launched over a year ago which the client has now decided to change around a lot. As it happens (just got off the phone), the client has now decided that they want more than one category for the case studies – industry / application and also an excerpt of the case study so I’m going to build it as an article list with the links embedded in the excerpt but I’m going to hang onto your snippet and give it a run in my sandbox installation as I’ll have a use for it in future for sure.

Thanks again.

Last edited by damienbuckley (2009-03-05 03:38:28)

Offline

#6 2009-03-05 16:12:25

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

Re: Display a list of download files, sortable by category

damienbuckley wrote:

Unfortunately, I’m stuck with 4.0.6

You can still use asy_wondertag :)

Offline

#7 2009-03-05 18:10:30

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

Re: Display a list of download files, sortable by category

Els wrote:

You can still use asy_wondertag :)

Els maybe I’m wrong but I don’t think it’s so easy. Remember in 4.0.6 category_list cannot used as a container tag and there is no “children” attribute.
For what I recall it was simply not possible to have a totally automatic multilevel nested category list.

Offline

#8 2009-03-05 22:08:42

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

Re: Display a list of download files, sortable by category

redbot, what I meant was you can use asy_wondertag for the tag Damien mentioned in his first post:

<txp:asy_wondertag>
	<txp:file_download_list sort="description asc" form="files" break="li" wraptag="ul" category="<txp:category />" limit="999" />
</txp:asy_wondertag>

but this is meant to display a list of files on each category page, which is what I understood was the intention. Of course asy_wondertag is no replacement for your code, but I think you could still get a list of files sorted by category if you use if_different.

Offline

#9 2009-03-05 23:51:55

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

Re: Display a list of download files, sortable by category

Els wrote:

redbot, what I meant was you can use asy_wondertag for the tag Damien mentioned in his first post:

Ah! ok

but I think you could still get a list of files sorted by category if you use if_different.

Yes but not a nested one..
and… why don’t I stop to pollute the forum with absolutely pointless disputes? ;)

Offline

Board footer

Powered by FluxBB