Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Your page template includes two variables containing navigation menus that you can place anywhere you like in your Web page: $primary_links and $secondary_links. These variables contain items from the two Drupal menus of the same name—primary and secondary links. Drupal menus are collections of links to both on-site and off-site URLs.
To add new items to the menus, you can use one of two methods:
To add a link to an existing node, navigate to the editing screen for the node and adjust its menu settings as in Figure 4.3
You may also use the menu administration system to add a page to the menu as shown in Figure 4.4 by navigating to Administer, Site building, Menus, Add item. This method allows you to add links to off-site URLs.
To add subsection menu items, you use the same technique described above, but change the “Parent item” to the menu item in which your new subsection ought to be included. For example, suppose you have a set of primary links containing “Mammal,” “Amphibian,” and “Reptile.” To place “Kitten” as a subsection of “Mammal,” you would set the “Parent item” to be “Mammal” when adding the menu information for the “Kitten” node.
More menus into your page template
|
| The menu module provides a block for every menu, and blocks can be placed into any region on the site. To display a menu in a block, navigate to Administer, Site building, Blocks. Complete the on-screen instructions to add the menu to a Web site region. More information about creating custom, task-based menus appears in Chapter 8. |
Within the menu administration area, you can specify which menu is used for $primary_links and which menu is used for $secondary_links. By default, the variable $primary_links contains menu items from the menu “Primary links” and the variable $secondary_links contains items from the menu “Secondary links.” To alter the menus that are used for these two navigation variables, navigate to Administer, Site building, Menus, Settings and adjust the settings as appropriate.
The variable $secondary_links can be configured in one of two ways: Either this menu can contain a second set of sitewide links for your site with “secondary” content (for example, legal notice, contact information), or you can configure $secondary_links to contain the relevant subsection navigation for your primary links. Use the following steps to change the default behavior:
1. | |
2. | Choose the Settings tab. |
3. | Change the “Source for the secondary links” so that it matches the menu that is set in the “Source for the primary links.” |
4. | Scroll to the bottom of the Web page and click “Save configuration.” |
The page template variable $secondary_links now contains the subsection links that have been defined for each of the items in $primary_links. Referring to the previous example, “Kitten” will now be displayed in the output of $secondary_links when you select “Mammal” from the list of menu options provided by the variable $primary_links.