0

I'm getting to grips with Drupal 7 at the moment. One thing that I'm finding frustrating at the moment (perhaps because I'm misunderstanding) is blocks.

Can you not just have a blank block give it a template and do what you want? I'm creating a sub theme off of Bartik and would like to put the main navigation into it's own block (to keep things tidy) and then just call the region this block is set but this doesn't seem to work. It seems I have to have the body text from the block included and the navigation doesn't seem to work either. I have come from developing in wordpress which has the loop, if you're in the loop you can call what you please, but this doesn't seem to be the case for Drupal?

0

Block

  1. Define region in theme information file (https://www.drupal.org/node/171205).

    Example: regions[main-menu] = Main Menu

  2. Call the region in template file (html.tpl.php or page.tpl.php)

    Example: <?php print render($page['main-menu']); ?>

  3. Clear website cache

    Procedure: Configurations -> Performance -> Clear all caches

  4. Now you can assign any block to the region.

    Procedure: Structure -> Blocks -> Here you can see 'Main Menu' region as unassigned. Assign any block to this region (example: assign menu menu block to main menu region).

Templating

To know more about templating: https://www.drupal.org/documentation/theme

Since you are coming from a WordPress background, please get familiar with theme structure of Drupal and then start working on themeing.

|improve this answer|||||
  • I understand regions, my question was about blocks, I'd like to create my own custom blocks. – karl Nov 20 '15 at 13:52

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.