I have a custom content type (portfolio_img) consisting of a title field and image field. I'm displaying them in a view with flexslider pulling in both fields. I made a custom .tpl for this view so I could display the title field in another region (than the main content region). I'm confused what I need to add it. Do I need the portfolio_img's field's machine name or is there a separate machine name for the field render by the view? Is what I'm adding to a region (below) right?

print render(field_view_field('node', $node, 'views_field_title_field'));

Comments

Dev1.addweb’s picture

Create a view block with the field you need & Flexslider module. This will then appear in admin->structure->blocks. place that block in particular region. No need of custom tpl file for this.

Let me know in case of any query/concern regarding this.

Thanks!

patbranch’s picture

Thanks for the reply Deepali_Agarwal!

That is actually the first way I did it, but I ended up having sync issues between the main view and field as block. Using the left/right/pause controls (among other things) would throw off the slideshow even though I had the description flexslider profile linked to the image one.

Here's what it looks like (description on left as block like you suggested in this screenshot). https://www.flickr.com/photos/_pat/20252114059/in/dateposted-public/

vinoth.babu’s picture

First override your view tpl file and then

      foreach($variables['view']->result as $v) {
       // here you can render all view fields 
     }

patbranch’s picture

Thanks vinoth.babu!

This is what I have now which is currently giving me an error.

	
	foreach($variables['view']->result as $v) {
    print render(field_view_field('node', $node, 'title_field'));
    
	} 

Do I need the portfolio_img's field's machine name or is there a separate machine name for the field rendered by the view?

These are the errors:


    Notice: Undefined index: view in include() (line 19 of /home/pat/public_html/sites/dev.pbmedia.us/sites/all/themes/pbmedia15/page--views--portfolio.tpl.php).
    Notice: Trying to get property of non-object in include() (line 19 of /home/pat/public_html/sites/dev.pbmedia.us/sites/all/themes/pbmedia15/page--views--portfolio.tpl.php).
    Warning: Invalid argument supplied for foreach() in include() (line 19 of /home/pat/public_html/sites/dev.pbmedia.us/sites/all/themes/pbmedia15/page--views--portfolio.tpl.php).

vinoth.babu’s picture

Hi please print the values in "foreach" loop then find your value whether its coming or not . Please check the below code

    
    foreach($variables['view']->result as $value) {
    
       print "<pre>";print_r($value); // here you can find your field 'portfolio_img' 
    
    }