PDA

View Full Version : Adding attach download link to Threadbit


Powlo
04-01-2009, 08:39 AM
I'm customisizing my threadbit and i want a download button for the attachment contained within the thread but im having difficulty getting the url correct.

Ive been using this ..

<a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&d=$attachment[dateline]">

but that doesnt work.

Any ideas where im going wrong?

Mr-Moo
04-02-2009, 04:25 AM
You are trying to reference a thread from the threadbit. To my knowledge you must first reference a specific thread before calling any of its information.

Let me see what I can find out for you.

Well mate, I can get everything to work except the display of the 'attachmentid'. If someone can chime in on how to display the attachmentid then this will work just fine. You need to modify your code to look like:

<a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&amp;d=$thread[dateline]">TESTING</a>

Some key things to keep in mind:
-What happens when there are multiple attachments?
-In your original code, you did not have the HTML correct to even display anything, you only posted a link.
-In the future, please remember, when you are calling thread information you must refer to them with "$thread".

Hope I was able to help :)

// Edit //
I don't have the time to modify that, however that will display on every thread, regardless if there is an attachment. That must be modified to an IF statement to display/hide if there is/isn't an attachment. If I have time I will code and post.

Lynne
04-02-2009, 02:34 PM
I am pretty sure you will have to write a plugin to grab the attachmentid. And, as brought up, you will have to determine *which* attachmentid you are going to grab if there are multiple attachments.

nexialys
04-02-2009, 02:53 PM
in the threadbit list, you always see the attachment icon when there is attachments in that thread... click on it, and you have a popup with the full list of all the attachments... click them and if you have permission, you will be able to download them too...

Lynne
04-02-2009, 03:16 PM
I totally forgot about that. Thanks, nexia.

Powlo
04-03-2009, 11:52 AM
Thankyou all for your replies, im still no further forward but i will have a play and see what i get.

There will always be an attachment in the forums i am using this in, these forums use a different template to the others.

Thanks again

Mr-Moo
04-06-2009, 03:02 AM
Before you begin tinkering with anything you may want to ask yourself the questions some of us presented. In specific how you will go about handling multiple attachments.

Question - Why is it you don't want the window to pop-up? Any specific reasoning behind that?