I've seen a few posts here regarding putting user avatars next to activity posts. I want to do something similar to that, but instead of user avatars i was looking to have an icon show up to an indivual stream which would relate to the type of post it is.
for example
if a user posts a blog a little avatar of a pen or something shows up, if a user posts a picture a little avatar of a "picture" icon shows up etc.
I have tried to use the method of the user avatar with slight differences but it all goes over my head.
Any advice would be awesome. But please take into account i have never edited a module before nor do i have a great deal of php experience, so the more detailed the explanation the better.
Cheers and Thanks in advance!
Comments
Comment #1
Scott Reynolds commentedIn the end its pretty simple. Add the field Activity: type. this gives you the 'type' of Activity. Then theme up that field. Intro to Views theming: http://drupal.org/node/352970
I would do something like
<span class='str_replace(' ', '-', $output)'>$output</span>. With the tab indent CSS property the text inside the span will be shoved off the screen. And the background image should be in its place. Then its just positioning through CSS.Doing things like node->type gets a little harder, but same concept.
edit: fix the missing close tag for 'code'.
Comment #2
clarky commentedThanks for the quick reply scott...
sorry this may be a bit of a silly follow up question, but i did what you said, but instead a "(Node) Node: Type".
so now along with the activity "steam" message it also says what type of node is it...
the problem is looking in the code for each activity message the code surrounding the "(Node) Node: Type" is the same.
example on my activity "stream" currently i have a blog post message, a "news" post message, and an "events" post message showing up.
&
etc...
how do i make each span class unique to the node type so i can style it accordingly
sorry if this is more of a views question as opposed to an activity question.
Cheers
Comment #3
Scott Reynolds commentedThe link I posted in the previous message tells you how to change the markup for a specific field in Views.
Comment #4
clarky commentedAlright, thanks very much!
Comment #5
clarky commentedwhere specifically is the info in that tute, most of the php goes over my head and confuses me so i can't identify what i need.
sorry to be a pain
Comment #6
Scott Reynolds commentedSorry can't help much more then that. In order to do any mildly complex Drupal site, you are going to have to get comfortable with php.
Ironically, the only php required for a field theming is
print $output;.Comment #8
SamSound commentedthanks for the posts but I just dont get it. Ive added the operations field to the view, I have several activity operations, such as insert and fbss_submitted, and I would just like to swap the text of each operation with images. Ive created a views-view-field--operation.tpl.php. But I dont know what to put in their.