By nyleve101 on
Hi, I'm looking for a quick fix to some code...
I need the code to be reformatted so that it successfully prints the same results but in a views-view-field--field-video-fid.tpl.php
// Displays the media player with an Imagefield preview and the Play icon turned off
print swf($node-> field_video_advert [0]['filepath'],
array(
'params' => array('width' => '300', 'height' =>'300'),
'flashvars' => array(
'image' => 'activity_event_images/' . ($node-> field_image_product [0]['filename']),
'icons' => 'false')
));
Any help is greatly appreciated. Thanks
Evelyn
Comments
You have one to many arrays
You have one to many arrays in between the params and flashvars.
try this
http://drupal.org/node/305225
Thank you sooo much! I have
Thank you sooo much! I have no idea how i missed that page. You don't by any chance happen to know where i can find info on how to print that in a views field template like views-view-field--field-video.tpl.php do you?
Again, thank you so much!
I hope you're well and taking care of yourself.
Evelyn
Go Higher!!!
Not 100% sure but you should probably use the row output instead, use the "themeing information" link within views to retrieve the base code then overwrite the file so its the lowest one relevant to your view,
From here I would probably create the video output prior to the foreach and then create an if statement on the content output to check the field-handler to determine if its the field your after and replace accordingly..
step 1 create the content
you can use $fields['field_name']->content to retrieve the content of the field, so in the view set the output type of your image and file in the view to filepath and you will have all the details you need to produce the swf output.
I always remind myself that all the view is doing is creating a long print output so you can replace the filepath field with your desired output later without to much trouble its your view after all and thats what the templates are there for.
step 2 the if
then using the field handler check which content field is being created and output the video if its the filefield your after.
will take a fair bit of fiddling around and probably a few print_r();
but that should get you there.
Also if its just one result you can always remove the foreach and just do a print of what you need just make sure you are only effecting the relevant view!!
Thanks for all your help it's
Thanks for all your help it's been much appreciated! I decided to put my headache to rest and use the simpler option of plain images for my views.
Take care of yourself and thanks again!
Bounty closed! The Views
Bounty closed! The Views issue has been successfully and might i add speedily solved by Fabianx
Fabianx and Stuff thank you both so much for your help!
Evelyn
Hi, this is the views
Hi,
this is the views template code in case anyone else needs it. You'll need to change the fields and of course change the image cache preset so that it matches your own.
views-view-field--field-video-advert-fid.tpl.php
Hope all is well!
Evelyn