Active
Project:
Embedded Media Field
Version:
5.x-1.x-dev
Component:
Embedded Video Field
Priority:
Critical
Category:
Feature request
Assigned:
Reporter:
Created:
5 Apr 2008 at 10:27 UTC
Updated:
8 Oct 2008 at 20:22 UTC
Hi,
I am using emfield video_cck and Views.
When I using video_cck in views it show the thumbnail with the link to the node, but in image ALT and TITLE properties it shows "See Video" text in all thumbnails.
Instead "See Video" text I want to show the node title in each thumbnail.
I don't have experience with php. In video_cck.module there is code:
$output = l('<img src="' . $thumbnail_url . '" width="' . $width . '" height="' . $height . '" alt="' . t('See Video') . '" title="' . t('See Video') . '" />', 'node/' . $node->nid, array(), NULL, NULL, false, true);
I have changed the code to:
$output = l('<img src="' . $thumbnail_url . '" width="' . $width . '" height="' . $height . '" alt="' . variable_get($node->title,'Preview image') . '" title="' . variable_get($node->title,'Preview image') . '" />', 'node/' . $node->nid, array(), NULL, NULL, false, true);
Now i see "Preview image" in all thumbnails and not the node title.
What I do wrong and how can I solve the problem? Please help.
Comments
Comment #1
OpenChimp commentedI'm trying to do the same thing.
I know that I could easily theme the field or the view to change this, but I was thinking that if it's possible, it would be better to create a patch for em-field so that it automatically uses the title of the video as the title text on thumbnail images and links. This would be better for usability and for SEO.
Sorry that I'm not able to provide a patch since I haven't figured out CVS yet, but here's the code I changed:
I created an override function in my template.php - phptemplate_video_cck_video_thumbnail and duplicated the code found in video_cck.module line#332 and then changed the code as follows (commented part is how it is in the module)
This is basically the same thing dima700 was trying but without the variable_get. The fact that dima was getting "Preview image" returned confirms my suspicion that the $node->title variable isn't available for use here. This is kind of surprising to me. I thought that all the basic node variables would accessible from here. I know that uid and nid work, but many of the others return "".
Is there another approach to doing this?
I'm probably going to have to solve it through the theming of the view or the field at this point because of time constraints but I think this would be a good patch it it's possible to do.
Comment #2
OpenChimp commentedComment #3
aaron commentedyep, this needs to happen. moving to the correct issue queue.
Comment #4
George2 commentedyou need to do a $node = node_load($node->nid); before using node->title MikeyLikesIt
Comment #5
aaron commentedbumping up priority to make sure it happens soon. thanks
Comment #6
dima700 commentedGeorge2,
This exactly what I did to solve the problem.
Comment #7
OpenChimp commentedadding the $node = node_load($node->nid); before printing $node->title worked. The thumbnails now contain the correct title text in the alt and title attributes.
I'm a little worried about how much overhead this is causing. It's probably not a big deal, since my views display no more than a dozen or so thumbnails per page, but it still doesn't seem right to do a full node_load() just to get the title of the node.
Anyway, thanks for the help...