0

I hope that you could help me out with this. After much time ive finally managed to work out how to takeover the space that my breadcrumb was taking up. With this bit of space i thought about adding a banner in there or a welcome message. I dont want my site to look 'tatty' so the banner idea was soon forgotten. A welcome message would be nice but it will be going through all my site and im sure that folks will get a bit sick of it.

I was hoping to add a View of random quotes in there. You can see the 'spot' i mean on my frontpage here- http://onlinebanter.com/

As i type this though i'm a wondering if i could make that spot a block region? Then i could have a welcome message on the frontpage and then use it as a region to add helpfull advice for differant sections of my site. also i could add a random quote view for within nodes etc.

Could anyone offer me advice on either adding a view to a page.tpl or creating a block region in the wee spot ive found?

All help appreciated.

thanks

1

You can open your theme's .info file and add regions[my_region] = My region. Now open your page.tpl.php and do print $my_region (the name of the variable corresponds to the regions array index - see the first sentence) where the region should be rendered. After this make sure to clear your Drupal's cache so that it picks up the new region and the modified page.tpl.php.

Views can generate block displays. After you created the block display, you can use the Drupal's default blocks interface to put the Views block into the region you created, or better yet use a module like: Context which gives you more control over when to show which blocks in what region and when not to...

-1

If you go for the view block directly in the template, you can use views_embed_view('yourview', 'yourblockdisplay') in your block's block--id-of-block.tpl.php (name depends on your drupal version).

If you want to create a region (which is probably overkill here), you have to add it to your theme.info in this form regions[quotes_region] = Region name and add the relevant variable in yourtheme_preprocess_block, then add the block to the region.

  • Thanks Count. Overkill i dont do. I actually overkill the simplest of things not because im picky or owt i just go the long drupal way about most things. ah brilliant i like the sound of your quick fix. Im on drupal 6 Count. I will go ....bah ive been drinking wine all night. i will leave this best for later tonight when drupalers like me come out to play. I really appreciate you helping me along the road. Ive only been at drupal 100+ a week for 6 years nearly :( – Reg Gordon Feb 13 '12 at 10:41
  • I don't think it's overkill, and I think adding a region where a block should be rendered is the correct way to do it. And I don't think you need to preprocess the theme to add this variable, it will be automatically generated, you can just do 'print $quotes_region' in your page.tpl.php file where the region should be rendered, if the name of the region is quotes_region. And it's not very nice way to create a Views block and then views_embed_view that block into block's own template? It doesn't make sense... – Beebee Mar 14 '12 at 11:09

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.