0

I am trying to show a simple block on my home page in Drupal 6.

The Drupal has simple HTML Text.

My question is that how can I show it in my code in let's say Page.TPL.PHP

I searched Internet and tried this:-

 if (drupal_is_front_page()) {

      // $block = block_load('block',314);
      // $output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));
      // print $output;

      $block = module_invoke('user', 'block', 'view', '314');
      print $block['content'];

The block num is 314 but other than that I am not sure that what user, block or view means in the function. I want to show it on the home page, hence I put it in a condition.

Do I have to leave it disabled or should I enable it in some region so that it can be shown on the Home Page?

Thanksa lot.

0

If you have a suitable region to display the block, why not set it to display in that region and in the Block Visibility settings configuration under Show block on specific pages select Only the listed pages. Then in the text area type <front> to display it only on the front page.

|improve this answer|||||
  • This is what I am doing. But my block is showing at the end. I want to change the order and show it on top. – Steve Jul 25 '13 at 22:17
  • The easiest way is to define a region where you want it, then place the block in that region. Check out Regions in PHPTemplate on Drupal.org. – Triskelion Jul 25 '13 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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