Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-08-10 17:44:59

NicChen00
Member
From: Edmonton
Registered: 2011-08-05
Posts: 15
Website

is there a way to assign an image & download file to a single article?

i would like the client to be able to manage a single article where they can add a pdf file for download and a thumbnail image. is this possible?

the reason i want both in a single article is so the client can add multiple articles each with 1 pdf and 1 thumbnail. the form would then display all the articles. here is what i’m trying to achieve (except dynamically): http://dhs-wine.com/whatsnew.php.

maybe i’m thinking about this the wrong way? if there is a better solution let me know.

thanks.

Offline

#2 2011-08-10 17:51:35

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

Re: is there a way to assign an image & download file to a single article?

Hi

you can use custom_field for that, articles have 10 custom field, you can use oen of them to insert the pdf id.

Offline

#3 2011-08-10 19:00:59

NicChen00
Member
From: Edmonton
Registered: 2011-08-05
Posts: 15
Website

Re: is there a way to assign an image & download file to a single article?

i’m having trouble getting the file id from the custom field. i created a custom field called pdf and called the field from the file download tag. here is the code i have:

<txp:article_custom page="sales-sheets">
<txp:article_image />
<txp:file_download_link id="<txp:custom_field name="pdf" />">
<txp:file_download_name /> [<txp:file_download_size format="mb" decimals="2" />]
</txp:file_download_link>
</txp:article_custom>

the errors i get is:

Tag error: <txp:file_download_name /> -> Textpattern Notice: File tags cannot be used outside a file context on line 2337

Tag error: <txp:file_download_size format=“mb” decimals=“2” /> -> Textpattern Notice: File tags cannot be used outside a context on line 2337

Offline

#4 2011-08-10 20:23:45

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Re: is there a way to assign an image & download file to a single article?

Did you try putting that inside of <txp:if_custom_field>?

Offline

#5 2011-08-10 20:38:20

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: is there a way to assign an image & download file to a single article?

<txp:file_download_link id='<txp:custom_field name="pdf" />'>

Tag in tag must have single quotes.

Offline

#6 2011-08-11 14:40:58

jelle
Member
Registered: 2006-06-07
Posts: 165

Re: is there a way to assign an image & download file to a single article?

Hi Nicolas,

have a look it Redbot’s plugins: Bot_Image_Upload and Bot_File_upload
http://www.redbot.it/txp

allows your user to select files/images and the write tab and “attach” them to the article.

Offline

#7 2011-08-16 16:29:46

NicChen00
Member
From: Edmonton
Registered: 2011-08-05
Posts: 15
Website

Re: is there a way to assign an image & download file to a single article?

thanks for all the help! the single qoutes did the trick and i love the bot_image_upload plugin.

jelle: i’m read the instructions for the bot_file_upload but don’t understand how it works. or maybe i didn’t install it properly? i am assuming it’s supposed to work like the bot_image plugin where i can select from a list but i don’t see that? do you have a screenshot of what it’s supposed to look like?

Offline

#8 2011-08-16 21:03:10

NicChen00
Member
From: Edmonton
Registered: 2011-08-05
Posts: 15
Website

Re: is there a way to assign an image & download file to a single article?

never mind jelle. got it to work. thanks for the awesome plugins. this will really make things easier for my client.

Offline

Board footer

Powered by FluxBB