Textpattern Forum

You are not logged in. Register | Login | Help

#1 2012-06-30 06:38:29

thehairyhand
Member
From: Australia
Registered: 2012-05-08
Posts: 11

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

#2 2012-06-30 08:16:58

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 4,927
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>

Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

#3 2012-06-30 10:35:28

thehairyhand
Member
From: Australia
Registered: 2012-05-08
Posts: 11

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

#4 2012-06-30 12:14:30

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,383
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

#5 2012-06-30 12:56:47

thehairyhand
Member
From: Australia
Registered: 2012-05-08
Posts: 11

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

#6 2012-06-30 13:50:13

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 4,927
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)


Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

#7 2012-06-30 22:19:52

thehairyhand
Member
From: Australia
Registered: 2012-05-08
Posts: 11

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

#8 2012-06-30 22:40:59

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,383
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

#9 2012-06-30 22:54:00

thehairyhand
Member
From: Australia
Registered: 2012-05-08
Posts: 11

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

#10 2012-06-30 23:34:13

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,383
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

Board footer

Powered by FluxBB