By webdev2 on
I am using D.10 and the latest version of VIEWS 2. The nodes have a CCK-FILE_LINK type that is an uploaded PDF file. I want the view title to link directly to the uploaded file not to the node then they have to click again to the linked file.
Can you do that? I've tried MANY permutations unsuccessfully.
If so, how?
Thanks.
Comments
Any ideas?
Any ideas at all?
_
I'm not sure what a FILE_LINK field is, but if you use filefield or upload, i believe you can choose what to display in the field options.
I can display the title of
I can display the title of the link but I can't get the view link to link to the embedded file inside the node - that's what I am shooting for. Sorry for confusion.
_
Sorry-- I still don't know what a CCK FILE_LINK is. Without knowing how you are attaching files to nodes I can't provide more specific suggestions.
Sorry. This is in Drupal 5.
Sorry. This is in Drupal 5. When I go to content type for this type, manage fields, the CCK type is a "LINK".
Here's what you have to do now to get to the pdf uploaded doc:
- go to the year, then the month to see all articles for that months
- all articles are currently links to the node of that CCK type that contains a field type link. That is the field I used to upload a pdf doc.
What I want is to save one step and be able to click on the article title and directly open the pdf doc. This owuld save opening the node and then clicking on the link to open the pdf doc.
Thanks.
I haven't been able to do
I haven't been able to do exactly what you want (using Drupal 6 and Views2), but it's possible to specify two fields: the title (field = "Node: Title", which doesn't have to have a link) and a download link (field = "Content: Click to") which links to the file, showing the filename.
Not quite as tidy perhaps, but effectively does what you want. And there's something to be said for warning users that they're going to be downloading a PDF file rather than linking to another HTML page.
_
I think that's the problem-- if you use the core upload module or the filefield cck field, you can easily control the output through the views UI.
Try displaying directly the
Try displaying directly the file field. So the view will display the name of the file and when they click on it, it will allowed them to download the file or view in the browser
Chetan
Chetan - that's what I am
Chetan - that's what I am asking how to do and when they click on the file name in the view, they open the pdf.
I think i expalined
I think i explained that...anyway here is the same in detail
1) You have a content type(Test) with a cck file field. Say its name is field_fileupload
2) Go to view and in filter select the content type(Test) which have cck file field that you created in step one.
3)In the Field section select content---> and select the file field that you created. In this case it will be field_fileupload
4) Save the view. Upload some file.
5)Boom you will see the files..
For example how it would look like see this
http://best.rutgers.edu/library
Chetan
_
That's the problem-- the op is using a LINK field, not a filefield or upload attachment.
Right, as indicated in the
Right, as indicated in the initial post, it is link field, not an upload field.
Any ideas? Can it be done? Thanks!
_
I don't have a link field handy to check, but if there aren't any options in the field configuration box in the views ui that produce the result you want, then you'd have to theme the view.
Hmm..ok in the views you have
Hmm..ok in the views you have flexibility of giving custom url to the title. In that custom url give the file path....so in my case
The title will be Flyer and custom url will be http://best.rutgers.edu/files/RES%20Meeting%20Flyer.pdf
file path. So when user click on it he will directly get the file...
Chetan
Chetan - thanks, you're
Chetan - thanks, you're right. I tried that but that would mean manually going to every node and writing that out - if I understand you correctly.
I think I'll just stick with what I have - the user goes to the node then to the file link. In the future I will have an upload field instead of a link field and this will be a mute issue.
Many thanks to all who replied!
I want the title to link to the file
I'm using Drupal 6.10 with Views 2. I have a node with a cck file field. I have a client who's site visitors are used to clicking on the title link to get to a pdf. SO the workaround of having both the title (unlinked) followed by the fie name linked to download the file isn't going to work. I need to have the link text to download the file be the title of the node. I tried playing around with the field output configuration in Views 2, but I can't seem to find a way to make the file attachment field display the title as a link, only as static text. I also tried to replace the title field output with the path to the attached file, but that didn't work either.
Is it possible to do it within views? If not I'm a newbie when it comes to theming overrides. I know how to create specific tpl files, but don't know which type I would need to create here and what code to put in to do the replacement. Any help here would be much appreciated.
_
I'm not sure whether this can be done through the ui, but it definitely can be done with theming. See Views 2 theming.
One untidy way if you want to
One untidy way if you want to try and it will work...
Requirement - You will need CCK Link field for this apart from cck file field
Step 1) In the setting give your CCK link field label Title
Step 2) Now create a node using your specific content type which content both cck field. In the Title field(cck one ) repeat the Title of the node and in the link field put the file location (which is nothing but file upload path. So if your upload path is /sites/default/files then the url of the file will be yoursite/default/files/filename..)
Step 4) Upload the file and save the content type. (Make sure the filepath is same as your url field)
Step 5) Now go to views and in Fields section remove the node title and select the cck Link (labeled Title )field that you created in step1. In this way it will display the Title of the node which is nothing but a link to a file.
Hope that help
Chetan
http://www.cjain.com
Thanks, I'll give it a try!
Thanks, I'll give it a try!
field linked to file
This stumped me for quite a while. Then I walked away from it for a few weeks and today I figured it out:
In the Views/edit page:
Fields (in this order):
Content: fileFieldName (any field of type CCK file - other file-related fields may work as well)
settings: exclude from display (it merely provides the replacement pattern that points to the file)
Node: Title
settings: Output this field as link
Link path: http://serverNameHere/sites/siteNameHere/files/[field_update_file_fid]
(note that your files may be in a sub-folder of "files")
Other fields as desired
Thanks this worked for me
Thanks this worked for me using Views2 + CCK Filefield.
Perfect solution!
Thanks @wavydave - that's exactly the solution I needed. I was trying to figure out how to do this with webform submissions, which aren't nodes and don't have great Views integration yet, so therefore I can't use @jtaber's trick below, which is the way I would normally do it. But you can get the submission ID, which allowed me to build the path the way you suggest. Great tip!
I found a slightly different
I found a slightly different way of doing this. In the Views/Edit section add fields :
Node: Title
Upload: Description
Set "Node: Title" to "Exclude from Display"
Set the "Upload: Description" to "Rewrite the output of this field"
In the text field put [title]
Make sure "Link this field to download the file" is checked.
Link to file using node title - works for me.
I played with a few of the examples on this and none quite worked as expected. Here's what I did:
create the view selecting the fields like so, and in the exact order
Content: myFileFieldName
Node: Title
For the content field, I set: Exclude from display and set the Format to :Path to File (Not generic files).
For the Node: Title I set output as a link and set the replacement pattern to: [field_myFileFieldName _file_fid]
This results in the label of the "link" being my node title and the link being the fully qualified PATH to the file... If you leave the Format to "generic files" the [field_myFileFieldName _file_fid] is replaced as just the file name.
I couldnt find that last little bit in any discussions and just got lucky trying it.
Thank You, This worked for
Thank You, This worked for me.
Just to add to your solution.
after setting the link path to [ field_myFileFieldName_file_fid] for the Node, we should check the Use absolute path which is below the link path box.
I used this tutorial Example:
I used this tutorial Example: Theming a Specific CCK Content Type to get my basic CCK fields and display them in a custom way.
The file upload field I created was called 'field_vcard'
The way of displaying it described in the article above is:
<div>Vcard<?php echo $node->field_vcard[0]['view'];?></div>but this shows the filename as the link, rather than I wanted the link to simply say 'vcard'.
so instead I changed this to:
<a href="<?php echo $node->field_vcard[0]['filepath'];?>">vCard</a>which builds the html link by grabbing the nodes 'filepath'.
However I noticed that the path was relative to the node (which didn't return the correct file.) To fix this I added ../ into the code:
<a href="../<?php echo $node->field_vcard[0]['filepath'];?>">vCard</a>This seems to be working well for me.
Best of luck
Sharing something slightly different from the other posted combo
Accidentally deleted a Views item, and had to recreate things. Sharing something slightly different from the other posted combos that worked for me.
- I didn't have the Node: Title (or try at least to Do not display this field)
- Added the field_pdffile field, then selected Rewrite the output of this field > entered custom html and code, example:
<a href=[field_pdffile_fid] target=_blank title=[title]>[title]</a>- Had above link to open to new window and set a mouseover tooltip text to reflect the title (maybe some scripts can be inserted as well)
- Set Format to: URL to file
The combined settings seemed to work for me at least on D6. Here's the sample output - http://www.pemsea.org/publications/documents/pc5