1

In my content type I have two multi values fields for images and embedded videos. Those fields are displayed in view.

I wanted to display elements of these fields in carousel. I found solution on google, but this solution only works when I have more than one items in field.

I didn't manage to do it for one element in the field.

I want to display those fields (no matter if field has one or more items) in html list.

Could somebody give me any advice?

[EDIT]

I try similar solution to @Shoaib Nawaz answers, but because of memory problems I can display values only from $row object.

The part with data of embedded videos look like this:

   [node_data_field_video_field_video_embed] => Array
        (
            [0] => Array
                (
                    [embed] => http://www.youtube.com/watch?v=XnflHoDIwFk
                    [value] => XnflHoDIwFk
                    [provider] => youtube
                    [data] => a:6:{s:20:"emvideo_data_version";i:5;s:23:"emvideo_youtube_version";i:5;s:8:"duration";i:831;s:8:"playlist";i:0;s:9:"thumbnail";a:1:{s:3:"url";s:43:"http://img.youtube.com/vi/XnflHoDIwFk/0.jpg";}s:5:"flash";a:3:{s:3:"url";s:32:"http://youtube.com/v/XnflHoDIwFk";s:4:"size";s:4:"1011";s:4:"mime";s:29:"application/x-shockwave-flash";}}
                    [status] => 1
                    [version] => 5
                    [title] => 
                    [description] => 
                    [duration] => 831
                )

The part of images looks like:

[node_data_field_photos_field_photos_fid] => Array
        (
            [0] => Array
                (
                    [fid] => 18515
                    [list] => 1
                    [data] => a:2:{s:3:"alt";s:30:"System stołów automatycznych";s:5:"title";s:0:"";}
                )

Screen with jcarousel with this stuff (worked only for fields with more than one items):

enter image description here

Now I need to find function to turn this data to html or code it all.

2
  • How you want to show your images and videos? What type of videos do you need embed code of you tube videos from url or id? Commented Oct 6, 2011 at 21:14
  • In html list, colorbox preset images or videos. I am adding videos by pasting url. I am adding screen how it should look like.
    – Codium
    Commented Oct 7, 2011 at 8:46

1 Answer 1

1

Try to do it with View field template. Edit your view and check for 'Theme information'. View will suggest some suitable field template according to your field and view's name. The most common template of fields is views-view-field.tpl.php

Other specific can be:

views-view-field--<my-field>.tpl.php,
views-view-field--<my-view>.tpl.php,
views-view-field--<my-view>--<my-field>.tpl.php,
views-view-field--<my-display>.tpl.php,
views-view-field--<my-display>--<my-field>.tpl.php,
views-view-field--<my-view>--<my-display>.tpl.php,
views-view-field--<my-view>--<my-display>--<my-field>.tpl.php

Here <my-field>, <my-view>, <my-display> are placeholders to replace actual field, view and display name.

Create any one of template in your active theme directory and
Try print_r(get_defined_vars()); in your template to know available variables/values.

5
  • Thanks you this response, but because of memory problems I can display only $row values. Result of $row is in my edited question.
    – Codium
    Commented Oct 6, 2011 at 20:50
  • print_r(array_keys(get_defined_vars())); this first let you know what are variables available here. Then dig variables one by one. Have a try with $field(s) variable. Commented Oct 6, 2011 at 20:55
  • When I try to print $field which is probably what I want I am getting WSOD unfortunately
    – Codium
    Commented Oct 6, 2011 at 21:24
  • Edit settings.php for ini_set('memory_limit', '200M'); as WSOD id normally due to memory shortage. Commented Oct 7, 2011 at 10:42
  • Thanks, changing settings.php doesn't work, hope someone increase memory for me in php.ini
    – Codium
    Commented Oct 7, 2011 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.