Hi!

I have created a block (using views) to view the latest blog entries in a table and want to insert it into my php file for my frontpage. Any idea how to do this? Thanks so much!

Comments

VM’s picture

adminster -> blocks

find the newly created block and enable it.

if you only want it to show on front page, click config on your block and toward the bottom of the settings for this block you will see the area to show on pages.

gurge’s picture

Hi! Thanks so much!

But i have a follow up question...

I am using the method of

 if ($is_front) {
  include('page-front.tpl.php');
  return;
}

in my page.tpl.php file,

so when i use your method, I put display on the following list and I put
and that doesn't work.

I tried putting page-front.tpl.php in the box as well, and that doesnt work.

Appreciate your help on this! :D

VM’s picture

Researching a bit i found this post http://drupal.org/node/29132#comment-49905
the post after that post may help ?

specifically http://drupal.org/node/29132#comment-49912

gurge’s picture

hmm in researching as well, i managed to find somethign that works, which is putting it directly into the template:

<?php
  // load a second copy of the view -- unfortunate but we don't have access
  // to the existing one.
  $view = views_get_view('latest_blogs');

  // the array() indicates no arguments, which will provide the summary view.
  // We also don't want the pager for this view.
  $limit=3;
  print views_build_view('embed', $view, array(), false, $limit);
?>

And diverting from the core question a bit, do you have any idea on how to format tables that are displayed using the above code, meaning called from a view? I cant seem to find anything on it :\

Thanks for all the help so far! ;)

VM’s picture

maybe this ? http://drupal.org/node/63230 which also led me to this ? http://drupal.org/node/42592

gurge’s picture

Yeppers! been looking at those, Thanks! will do me some reading now ;)