By David.W on
Hi fellow Drupalians,
I have searched the module pages but i couldnt find the thing i want.
I have a view with news items. The view is created using the table style and contains several fields. Icluding the Uploaded: Listed field. This field says yes or no behind the item if there is an attachment or not.
Yes and no is oke.. but i'd rather see a paperclip (like outlook and gmail have). The paperclip is recognizable for users to see instantly if there's an attachment or not.
Anyone have seen a module or knows how i could create this?
Thanks in advance!
-Aeroniro
Comments
You could use Views Custom
You could use Views Custom Field and a tiny bit of PHP code to produce what you're looking for.
http://drupal.org/project/views_customfield
Thanks but
Thanks again matt,
Except I am bad at php :(. I'll give it a try though i dont know where to start.
Maybe you or someone can give me some example code?
Views Custom Field exposes an
Views Custom Field exposes an object called $data with the fields you've added to your view.
1. Make sure you add the file upload listed field,
2. tick the checkbox to hide from display,
3. add a custom field, use the PHP option, and paste in the sample code.
You might need to put this bit of code in temporarily to work out the exact name of the variable .. I don't know off the top of my head.
Matt, ur a hero, thanks
Matt, ur a hero, thanks alot!
I didn't try it though, i will do later this day/week when i have enough time ;).
But thanks anyway for ur help!
this is the
this is the outcome:
[upload_list] => 1 (there is an attachment)
and
[upload_list] => (no attachment)
I inserted the code without the if statement and the paperclips are printed, so that works.
But with the if statement it doesnt work. I think its because I dont know which fieldname to use.. :x
i did this for now:
Thanks again for helping ;)
I'll tinker with it meanwhile waiting for ur answer
Got it!!! Because i'm a php
Got it!!!
Because i'm a php noob, i tinkerd too much with your precious code! But, i took a few steps back and got the right code now.
Here it is:
Thanks alot matt!