2

I have two templates in my theme called page--front.tpl.php and page.tpl.php. When I click at the link "Demonstrate block regions" (Structure/Block) it shows the page.tpl.php template. Is it possibly to change the template to page--front.tpl.php?


Thank you for your answer.

My .info file look like this
name = xxx
description = xxxxx
core = 7.x
engine = phptemplate
stylesheets[all][] = css/css.css
regions[banner] = Banner
regions[header] = Header
regions[leftcolumn] = Left Column
regions[content] = Content Column
regions[rightcolumn] = Right Column
regions[footer] = Footer

It should be all right I think?

page.tpl.php is my sub page and consist of the regions: banner, header, left column, content column and footer. page--front.tpl.php is my front page and consist of the regions: banner, header, left column, content column, right column and footer.

The website works perfectly. It shows content as it should do. But when I use the link "Demonstrate block regions" (Structure/Block) it shows the page.tpl.php template (I have checked that with devel_themer). I can see the regions: banner, header, left column, content column and footer. Not the region right column.

I wish it was the template page--front.tpl.php instead of page.tpl.php so I could see all the regions.

0

In order for a region to show up on the demonstration block, you need to define it in your theme's .info file and print the region in page.tpl.php (or the overrided version). The following could be the issue

  1. Cache is not cleared (i.e. drush cc theme-registry if you are using drush)
  2. Theme's .info file has not listed the new region
  3. Page template is not overrided properly
  4. The region is not printed properly in .tpl.php file

I would say, have a look into guide on how to override a template file prpperly here https://www.drupal.org/node/1089656 and https://www.drupal.org/node/223440#custom-suggestions.

If you would like a region to NOT show up on the front page, you can simply do not supply content to it and Drupal will not render it.

If you would like to add an extra region, then google for some tutorials on how to create custom regions.

Install Devel related modules.

devel_themer module, make it very easy to do themeing in Drupal, specially if you are new.

If you have devel_themer installed and enabled, then you can click on the page and see which template file is being used to render the page. You can click on regions, blocks and elements and it will give you details on how it is rendered and which template/function being used.

Hope this general answer help you.

0

Some base themes like Omega provide an option to always show regions. If you're not using one of these you can always create one block per region with some lorem ipsum content for example.

0

Basically what you're asking is: "Is it possible to 'demonstrate block regions' using a specific theme template that you've created?"

For this, I think you can use hook_preprocess_page() (to edit the page before it gets displayed), and then provide a 'theme_hook_suggestion' for your template. So Drupal would see the suggestion and use your template for the 'admin/structure/block/demo/[theme]' path.

The accepted answer on the "Change templates based on path alias" question describes how this works nicely.

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.