0

I have a menu block and it will be displayed on all pages, but I need to change the placing of it. On certain pages (dependent on path) I need to display it above the main content, while on other pages I need to place it below the content. I am experimenting with the context module and I was able to put the block above the content, but then on these pages, the menu shows BOTH above and below the content.

I have a solution in mind, but there must be a better way: I can set up two regions, one above and one below the content, then put the menu block in the region below the content, and set up a context to put the menu in the above region AND hide the below region. This could work, though I think there should be a more elegant way.

  • I think the solution might be to disable this block at admin/structure/block and then assign to appropriate region with the context. – Jack-PL Aug 6 '13 at 16:45
1

Hope this will help you.

In Drupal 7 you can achieve it using Context module as suggested by the Jack.

Steps

  • Fist of all disable the menu block using admin/structure/block.

    enter image description here

  • As you specified you need to show menu block in two regions, then those 2 regions(main content and above the content) must exist. If not then create it.
  • Create a new context and add menu block based on your requirement and path.

  • Showing menu block block in region Content

    enter image description here

  • Showing menu block block in another region user bar second

    enter image description here

Reference :

  • +1, probably best to let context handle the placement of the block and to stop using the admin/structure/block page. – Sam152 Aug 6 '13 at 17:09
0

You can add the URL check logic in your theme's template.php (use theme_preprocess_page hook) and pass the result (something like $variables['isBlockAboveContent']) to the page.tpl.php and render the block where you need after checking the $isBlockAboveContent .

Hope this helps.

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.