Skip to main content

template_preprocess_page

Having a node's field show in a block region.

I'm currently building a website that has a three columned layout. The left most column contains the navigation elements, the center column contains the body, and the right side column contains supporting text for the article. So I created three block regions in my theme: left_sidebar, content, and right_sidebar. The problem I ran into was that the text in the right side column was different for every node. Having the user create a separate block for each node seemed very inefficient.


Drupal Menu: Add Primary Menu Parent to the Beginning of the Secondary Menu

Today I needed to take the parent menu item from my primary links and add it to the beginning of my secondary menu links. To begin, my menu structure looks like this:

  • Primary 1
  • Primary 2
    • Secondary 2.1
    • Secondary 2.2
    • Secondary 2.3
  • Primary 3

Default Menu Setup

The $main_menu variable will print a list item with:

  • Primary 1
  • Primary 2
  • Primary 3

When you click on the 'Primary 2' link the $secondary_menu variable will display: