Populate the Primary Links

In this step, we will add some useful links into the Primary links menu. As you populate the Primary links, think about the work your site members will be performing. You want your primary links to act as doorways to their most commonly-performed tasks.

The process for adding menu items into the Primary links is just the same as moving them into other menus. As shown in the following screenshot, when editing an existing menu item, select Primary links as the Parent item.

Parent item:

The maximum depth far an item and all its children is fixed at 9. Some menu items may nat he available as parents if selecting them would exceed this limit

Adding a Post Directly to a Menu

Users in a role with administer menu privileges can assign new posts directly into existing menus. For this example, we will assign our home page post, created earlier into this chapter, into the Primary links.

To return to the home page, click the logo or the site name in the top left corner of your screen. Then, click the edit tab to edit the post.

To be able to edit the post, you must be logged in as a user with the sufficient privileges.

As shown in the following screenshot, the Menu settings are at the top of the page.

Enter Home as the Menu link title, select Primary links as the Parent item, and submit the page.

Once you have saved the page, you will see the link to Home appearing in the Primary links, as shown in the following screenshot:

The Primary links appear in the top right corner of the screen as text links. As noted above, different themes present the Primary links in different ways. For example, some themes display Primary links as tabs or buttons. For a complete look at contributed themes and how they display the primary links, see

http://drupal.org/project/themes.

Adding a New Menu Item

In some cases, such as creating a menu item that links to an external site, you will need to add a new menu item into an existing menu—for example, you might want to link to your main school site from the class website.

For this example, we will add a link to http://drupal.org. At the risk of stating the obvious, you can use these same steps to place a link to any site in any menu.

To begin with, return to the menu administration screen by clicking the Administer | Site building | Menus link, or by navigating to admin/build/menu. Click the name of the menu you want to edit. For this example, click Primary links.

To add a menu item, click the Add item tab, as shown in the following screenshot:

Home - Primary links

Primary links List items ^^^^^^ Edit menu

Menu settings

|http://drupal.org |

The path this menu item links ta. This can be an internal Crupal path such as node/add or an external URL such as http://drupsl.org. Enter -=-iront-- to link to the front page ,

Menu link title: *

The link text corresponding to this item that should appear in the menu

Description:

The main website of Drup al

The description displayed I'jhen havering aver a menu item.

The ID far excluding or including this element is: edit-menu-descriptian - the path is: admin/build/menu-customize /primary-l inks/add

0 Enabled

Menu items that are not enabled will not be listed in any menu.

EH Expanded

If selected and this menu item has -children, the menu will always appear expanded,.

Parent item:

The maximum depth for an item and all its children is fixed at 9. Some menu items may not be available as parents if selecting them would exceed this limit.

Weight:

Optional, In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.

For each new menu item, you need to specify a:

• Path: this can be internal or external

• Menu link title: this text will be displayed in the menu

• Description: this text will be displayed when hovering over a menu item

• Parent item: to determine where the new menu item will be displayed

Click the Save button to submit the form and create the new menu item.

After the menu item has been saved, you are redirected to a page where you can reorganize the menu items via drag and drop.

Blocks and Block Placement FAQ

Due to their relationship to menus, the full range of functionality offered by blocks can remain unclear. This section addresses some commonly-asked questions about using blocks.

What is a Block? How is it Different than a Menu?

Blocks and Menus complement one another. Menus provide a way to create, group, and organize links. Blocks then display those menus.

What is a Region?

Regions are specific places on the page that can be used to display content. Regions can be used in conjunction with blocks, as blocks can be dropped into any predefined region. Most of Drupal's core themes have five regions enabled: Header, Left sidebar, Right sidebar, Content, and Footer. If you navigate to admin/build/block you can see the default location of these regions. These five regions are identified in the following screenshot.

What Else can I do with a Block?

A lot! You can create custom blocks that use HTML markup, or blocks that use PHP code. You can limit block visibility by user role, and by path. To get a sense of the full range of what can be done with blocks, check out the options available when you add a new block, at admin/build/block/add. Fully exploiting the power of blocks requires a working knowledge of PHP; in this book we explore some of these options

in context. The Drupal handbook includes a selection of PHP snippets related to blocks, at http://drupal.org/node/2i8 67. However, when using a snippet from the handbook, you should always check two things:

1. Make sure that the snippet is for the correct version of Drupal, as snippets for Drupal 5 will not work for Drupal 6

2. Test your snippet in a page first by using the "Preview" option. This allows you to make sure that the snippet works as advertised, as blocks do not have a "Preview" option

Can I Make a Block Visible to Specific Roles or on Specific Pages?

Yes. Every block has customizable block visibility settings. To access these settings, click the Administer | Site building | Blocks link, or navigate to admin/build/blocks.

"¡7 Role specific visibility settings

Show block for specific roles:

CD anonymous user CD authenticated user CD site admin CD student CD teacher

Show this block only For the selected role(s]. If you select no roles, the block will be visible to all users.

v Page specific visibility settings

Show block on specific pages:

® Show on every page except the listed pages. O Show on only the listed pages.

O Show if the following PHP code returns true (PHP-mode, experts only). Pages:

Enter one page per line as Qrupal paths. The '*' character is a wildcard. Example paths are blog for the blog page and biog/* for every personal blog. <fmnt> is the front page. If the PHP-mode is chosen, enter PHP code between <?php ?>, Note that executing incorrect PHP-code can break your Qrupal site.

The ID for excluding or including this element is: edit-pages - the path is: admin/build/block/configure/menu/menu-add-content

As shown in the preceding screenshot, block visibility can be set by role and by URL path. So, for example, a block could be made to disappear whenever content is being added or edited by using the Page specific visibility settings. Set the block to Show on every page except the listed pages, and enter the following URLs:

As the above example implies, you can use wildcards in the path name.

0 0

Post a comment

  • Receive news updates via email from this site