Custom Views Output


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. $view = views_get_view('reviews_front');
  4. $view->render();
  5. $images = array();
  6. $teasers = array()
  7. foreach ($view->result as $result) {
  8.  
  9. $node = node_load($result->nid);
  10. $images[] = $node->field_image[0]['view'];
  11. $teasers[] = node_teaser($node->body);
  12.  
  13. }
  14. echo '<div>';
  15. foreach ($images as $img) {
  16. echo $img;
  17. }
  18. echo '</div>';
  19. //same way for teasers ...
  20.  
  21. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.