Go to main content

Textpattern CMS support 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: 9,011
Website GitHub Mastodon Twitter

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 | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

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
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

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.

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: 9,011
Website GitHub Mastodon Twitter

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 | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

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
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Automate latest file download link by category.

Can you post a tag trace?

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
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

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.

Offline

#11 2012-06-30 23:52:31

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

Re: Automate latest file download link by category.

See next post please

Last edited by thehairyhand (2012-07-01 00:06:21)

Offline

#12 2012-07-01 00:02:29

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

Re: Automate latest file download link by category.

Hi Els,
Ok – I have posted the whole tag trace for front page – I couldn’t see any reference to the image we want to use – but this stuff confounds me anyway.
And btw – I have changed the image id to 77 (Just had to change the image file as the school newsletter has a new look.

I tried posting the tag trace directly here but it formatted harshly – so I have pasted the tag trace here

Emerton tag trace

Thanks

Last edited by thehairyhand (2012-07-01 00:05:28)

Offline

Board footer

Powered by FluxBB