When I upload a file with the CCK FileField module it shows as a linked filename.

What I want to do is, instead of the filename have something like "Download product information >".

So for every product it has the same text, but linking to the specific file for each product.

How can I achieve this?

Thanks.

Comments

WorldFallz’s picture

Probably the easiest way is to create a node-contenttype.tpl.php file for that content type (you can copy the node.tpl.php file, and be sure to clear the cache), set the display of that field to hidden, and just manually create a link to it somewhere in the file. Something like:

<a href="<?php global $base_url; print $base_url . '/' . $field_fieldname[0][filepath]; ?>">Download product information</a>

Where 'fieldname' is replaced with the actual name of the field, and the '0' is the index of the actual item (only matters if there are more than one item in the field).

podsnap’s picture

Thank you WorldFallz, that's a big help, it works just as you said it would.

Now all I have to do is figure out how to the same download link in the a view!

WorldFallz’s picture

Its actually easier in a view-- when you add the field for the link, you can use the 'rewrite the output of this field' option to manually code the link the same way.

podsnap’s picture

Thanks so much, WorldFallz, that works well. You've really helped me out there.

Much appreciated.