Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-02-15 20:30:45

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Creating a list of available files to download for a given category

Hi everyone,

I need to create a static article in one particular section with some introductionary text. In the sidebar I would like to display a list of files, sorted by their categories and parent categories, so that users could click the links to download those files. Something like this:

Download Files:

Quality Control:
  • Document 1
  • Document 2
  • Document 3
Forms:
  • Form 1
  • Form 2
  • Form 3
Manuals:
  • Manual 1
  • Manual 2
  • Manual 3

I’ve already uploaded the files and assigned (parent-) categories to them, but how do I generate that listing? I’ve looked at all the txp:file_… tags but none seems to do what I want.

Any help would be very much appreciated!

Cheers Martin

Offline

#2 2007-02-18 07:30:58

Jeff_K
Archived Plugin Author
From: Vancouver, British Columbia
Registered: 2005-08-19
Posts: 202
Website

Re: Creating a list of available files to download for a given category

I wrote a plug that does something like this. I will post it when I get a chance…

Offline

#3 2007-02-18 13:09:22

anoke
Archived Plugin Author
Registered: 2006-04-15
Posts: 152

Re: Creating a list of available files to download for a given category

Have you tried if_different? Using technique described in this thread with download form tags should give such output..

I haven’t tried that with files – I haven’t got so many files yet…


- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -

Offline

#4 2007-02-22 23:55:39

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: Creating a list of available files to download for a given category

Jeff_K wrote:

I wrote a plug that does something like this. I will post it when I get a chance…

I’d be very interested!

anoke wrote:

Have you tried if_different? Using technique described in this thread with download form tags should give such output..

Thanks, I’ll look into this. From first glance it doesn’t seem to work the same with file categories though.

At the moment I’ve settled for a temporary solution hardcoding the file listing using a simple form like this:

<txp:file_download_link>
<txp:file_download_name />
</txp:file_download_link><br />
<txp:file_download_description />

… and this in the page template:

<txp:file_download_list category="file-cat-name" form="files_plain" label="Parent Category" wraptag="ul" break="li" labeltag="h3" />

This is fine for any new files in existing categories, but I wish I could figure out a way to make new categories created by a user appear automatically in a nested listing like so:

		<ul>
			<li>Parent Category 1
			<ul>
				<li>Item 1
				<li>Item 2
				<li>Item 3
			</ul>
			<li>Parent Category 2
			<ul>
				<li>Item 1
				<li>Item 2
				<li>Item 3
			</ul>
			<li>Parent Category 3
			<ul>
				<li>Item 1
				<li>Item 2
				<li>Item 3
			</ul>
		</ul>

Any ideas?

Offline

Board footer

Powered by FluxBB