Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-02-03 11:03:27

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Handling download list(s)

Hello!

I’m doing my first steps with Txp in order to be able to mimic the present functionality on some sites which are atm done in WP/Concrete5.

One of the things is having download list for mp3 files with display of

Filename | (short) Description | Modified Date | Download counter | Filesize

All of that is available via file_download tags.

I used the following code:

|^.
|_. Filename |_. Description |_. Date |_. Size |
|-.
| <txp:file_download_link id="1">Filename 1</txp:file_download_link> | <txp:file_download_link id="1"><txp:file_download_description  /></txp:file_download_link> | <txp:file_download_link id="1"><txp:file_download_created format="%d.%m.%Y"/></txp:file_download_link> | <txp:file_download_link id="1">(<txp:file_download_size format="m" />)</txp:file_download_link>  |
| <txp:file_download_link id="2">Filename 2</txp:file_download_link> | <txp:file_download_link id="2"><txp:file_download_description  />| </txp:file_download_link><txp:file_download_link id="2"><txp:file_download_created format="%d.%m.%Y"/></txp:file_download_link>| <txp:file_download_link id="2">(<txp:file_download_size format="m" />) </txp:file_download_link> |

and everything is well, but I wonder if it’s possible to display content for:

Description | Date | Size

but have active (download) link only for ‘Filename’ field?

Another question is if there is some plugin which could help arranging this table of download links whenever we need to add new audio files to the list for public download or do you suggest some more ‘automatic’ approach?

{Edited title to better reflect the topic’s content. Uli}

Last edited by uli (2013-03-16 19:14:52)

Offline

#2 2013-02-03 11:37:26

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,172
Website GitHub Mastodon Twitter

Re: Handling download list(s)

You can automate the process by adding <txp:file_download_list /> and assigning a category to those files.

Something like

<txp:file_download_list wraptag="table" break="" category="your_files_category">
<tr>
<td><txp:file_download_link><txp:file_download_name /></txp:file_download_link></td>
<td><txp:file_download_description /></td>
<td><txp:file_download_created format="%d.%m.%Y"/></td>
<td><txp:file_download_size format="m" /></td>
<td><txp:file_download_downloads /></td>
</tr>
</txp:file_download_list>

… you get the gist :)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2013-02-03 15:21:13

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: Handling download list(s)

colak wrote:

You can automate the process by adding <txp:file_download_list /> and assigning a category to those files.

Perfect!! Thanks a lot.

Offline

#4 2013-03-14 16:58:23

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: Handling download list(s)

colak wrote:

You can automate the process by adding <txp:file_download_list /> and assigning a category to those files.

I had to fix some other things first and now resuming/finishing this work…using of file_download_list tag seems nice solution to automate things, but wonder how to add the header like:

<tr>
<th>Filename</th>
<th>Size (MB)</th>
<th>Date</th>
<th>Counter</th>
</tr>

before the table data rendered by the txp_download_list tag?

Offline

#5 2013-03-14 18:32:56

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,172
Website GitHub Mastodon Twitter

Re: Handling download list(s)

Hi Gour,

you could move the table out of the automation

<table>
<tr>
<th>Filename</th>
<th>Size (MB)</th>
<th>Date</th>
<th>Counter</th>
</tr>
<txp:file_download_list wraptag="" break="" category="your_files_category">
<tr>
<td><txp:file_download_link><txp:file_download_name /></txp:file_download_link></td>
<td><txp:file_download_description /></td>
<td><txp:file_download_created format="%d.%m.%Y"/></td>
<td><txp:file_download_size format="m" /></td>
<td><txp:file_download_downloads /></td>
</tr>
</txp:file_download_list>
</table>

> Edited to add: If you want to check if there is anything to download before the table is rendered you could use a variable.

<txp:variable name="downloads" value='<txp:file_download_list wraptag="" break="" category="your_files_category" />' />
<txp:if_variable name="downloads" value="">
<txp:else />
<table>
<tr>
<th>Filename</th>
<th>Size (MB)</th>
<th>Date</th>
<th>Counter</th>
</tr>
<txp:file_download_list wraptag="" break="" category="your_files_category">
<tr>
<td><txp:file_download_link><txp:file_download_name /></txp:file_download_link></td>
<td><txp:file_download_description /></td>
<td><txp:file_download_created format="%d.%m.%Y"/></td>
<td><txp:file_download_size format="m" /></td>
<td><txp:file_download_downloads /></td>
</tr>
</txp:file_download_list>
</table>
</txp:if_variable>

Last edited by colak (2013-03-14 18:38:50)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2013-03-14 19:57:23

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: Handling download list(s)

colak wrote:

you could move the table out of the automation

Ahh…neat trick. Thanks a lot. ;)

Edited to add: If you want to check if there is anything to download before the table is rendered you could use a variable.

Thank you very much for very instructive posts!!

Offline

Board footer

Powered by FluxBB