2012-06-30 06:38:29

thehairyhand
Member
beta
Real name: Robert
From: Australia
Known languages: Australian, English, American, New Zealandish

Automate latest file download link by category.

Hi there,
My apologies for what may be a basic question, but after trawling and trial and error – I can’t seem to get this to work.
Currently in the sidebar of my school’s website, I have this –

<li class=“sidebox”>
<h2>School Newsletter</h2>

<a href=”/file_download/28” ><img src=“images/37.jpg”></a>
</li>

Which shows as an image that is a link to file 28. Each time we get a new newsletter, we have to upload, and then go to sidebar and change id.

I want this to be automated – as in upload newsletter, give it the category “Newsletters” then the latest newsletter becomes the new download.

I have used the following in an article that creates an automated list of newsletters, and the latest one appears at the top as soon as it is uploaded and given the category “Newsletters”

<txp:file_download_list limit=“10” break=“li” wraptag=“ul” category=“Newsletters” sort=“created desc” />

So, I want to marry the two ideas. Click the image on the sidebar and the latest newsletter downloads – without having to go into the sidebar form and change the id. I also don’t want any of the text that appears like file name, download size etc to appear – just the image as in the top example.

Any ideas?

Offline

 

2012-06-30 08:16:58

colak
Admin
omega
Real name: Yiannis
From: Cyprus
Known languages: el, en
Website

Re: Automate latest file download link by category.

Hi:) Couldn’t you just use

<txp:file_download_list limit="1" wraptag="p" category="Newsletters" sort="created desc"><img src="/images/37.jpg" /></txp:file_download_list>

Offline

 

2012-06-30 10:35:28

thehairyhand
Member
beta
Real name: Robert
From: Australia
Known languages: Australian, English, American, New Zealandish

Re: Automate latest file download link by category.

Thanks Colak,
I tried it – but just get the file download link as file name, with category name and download size and number included. The image does not appear.

Hmmmm….

Offline

 

2012-06-30 12:14:30

Els
Admin
omega
Real name: Els Lepelaars
From: The Netherlands
Known languages: nl, en, (some: de, fr, es, it)
Website

Re: Automate latest file download link by category.

What about this:

<txp:file_download_list category="newsletters" limit="1" sort="created desc">
   <txp:file_download_link><txp:image id="37" /></txp:file_download_link>
</txp:file_download_list>

And change the category name to ‘newsletters’ (all lowercase). Capitals in category and section names can cause problems.


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

 

2012-06-30 12:56:47

thehairyhand
Member
beta
Real name: Robert
From: Australia
Known languages: Australian, English, American, New Zealandish

Re: Automate latest file download link by category.

Thanks Els,
No… same result. No image – just the text with file download name etc.
I have now changed the category name to all lower case. Thanks for the tip.

Offline

 

2012-06-30 13:50:13

colak
Admin
omega
Real name: Yiannis
From: Cyprus
Known languages: el, en
Website

Re: Automate latest file download link by category.

Do you have an image at 37 id?

Last edited by colak (2012-06-30 14:06:25)

Offline

 

2012-06-30 22:19:52

thehairyhand
Member
beta
Real name: Robert
From: Australia
Known languages: Australian, English, American, New Zealandish

Re: Automate latest file download link by category.

Hi Colak,
Yes, and this is working in the sidebar

<li class=“sidebox”>
<h2>School Newsletter</h2>

<a href=”/file_download/28” ><img src=“images/37.jpg”></a>
</li>

but whenever I tried using file_download_list – I just get the text links and info, and the image does not appear.

Offline

 

2012-06-30 22:40:59

Els
Admin
omega
Real name: Els Lepelaars
From: The Netherlands
Known languages: nl, en, (some: de, fr, es, it)
Website

Re: Automate latest file download link by category.

Can you post a tag trace?


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

 

2012-06-30 22:54:00

thehairyhand
Member
beta
Real name: Robert
From: Australia
Known languages: Australian, English, American, New Zealandish

Re: Automate latest file download link by category.

Im not sure how to Els,
I read this

“Check the tag trace
In Debugging mode, Textpattern appends a Tag Trace to the HTML output of each page. View the HTML source of the page, and scroll to the bottom. The trace looks something like this:….”

So I put my site into debugging mode. No errors appearing anywhere, and I can’t see any tag trace in my pages or forms…

Offline

 

2012-06-30 23:34:13

Els
Admin
omega
Real name: Els Lepelaars
From: The Netherlands
Known languages: nl, en, (some: de, fr, es, it)
Website

Re: Automate latest file download link by category.

You need to view the page’s source (right click, view source?). The tag trace is at the bottom.


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

 

Powered by FluxBB