Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14120 reviews 1680 hosting providers

Questions & Answers

printing formatted content of a View field in Drupal 7custom template

Aug 30, 2013 by carebare
Hi
I want to print the content of  some Viewfield content in my Drupal custom template. They’re separate blocks inside the same View.
This I the code I tried
<?php echo $node->myfield_fie1[0]['view']; ?>
<?php echo $node->myfield_fie2[0]['view']; ?>
But that didn’t work
Can anyone please help me print this?
thanks

1 Answer

0 votes
Aug 30, 2013 by RalphK
If you are using a view in your template, you can use the view_embed_view() like this
<?php print views_embed_view('myview','block1', $node->nid); ?>
<?php print views_embed_view('myview','block2', $node->nid); ?>