Introducing Blocks

The center of the page shows blog entries, but the left and right margins contain blocks. Each Drupal theme can define its own regions for blocks; the standard ones are left, right, header, footer, and content. Many themes define additional blocks. If you change a theme, you may have a little rearranging to do, but your blocks should work properly in their new locations.

In Figure 19.1, you can see blog entries in the center content section. The left and right regions contain blocks. Starting in the upper left, these are the blocks:

► User Login—Standard Drupal block. If a user is logged in, it does not appear. (You do not even have to click a check box for this behavior.)

► Downloads—Below User Login is a Downloads block. You can create a block of your own with a title and text. Figure 19.2 shows how the Downloads block is specified. You give it a name, a title, and its text. If you want to be sophisticated, you can limit its visibility. In this case, the block is shown only to anonymous (non-logged-in) users. A companion block is shown to authenticated (logged-in) users; it contains download instructions.


Use blocks to display information in specific page regions.

,f North Country Comuiîing I

More on tho Kindle/1984 Issue

WaVo frrina oui mora about It« KhtdWISM Issua in wttch oopua of dowrtoad. (Son Urn NY Time articto hm).

m Krida iPtm epp car lyndnnzB with your Khdu. R oho rfm lor t&tm m Hl«wi. Ähwgh Ita net mwq Ihn) sf^gno H using IM» rttwl Is your iPhoria otjfus? (Ion h HitUí» «pitntfng (www fw»»), wmm.üuhpaiuSmu npnnod « VOÍB1 lo Ihö pufato today Willi ttw ircOo. INhan Amencana Cor Soo lAhwo Thuir

90 US-Tfl th» criglnit iPhono |ÖG) Monty Gem.' TV* IT «Vellen m inl*q*|ing lu lj*.

DK (iwrteaOiflw^lky^pfl*^*^ Using 1h« IPJyna 3Q (30061 tho Mt ahom budgM rurfcar tor FY® by ^jooey. Cfck en a bar, and po ehjri 1er due ngrrcy «ffauui) nl tha right sharing pwlramanot ty ow and acheduia. Th» pio on>1 n oickabta (er more dotai to-


Create a simple text-only block.

' n o iv n I u.i d n n o ri yrrvouí' fciock ; Jess* Fe.>r / Nonh Country Ccwufiir*

Subscribe Poll

Uxing Hin IHion» 3G [2008]

IMng Ilm IRim» ta 5

Wading far a service cortina I !7

WO buy an IWione as »an as my rotary wrtd phoot breaks

Total votos:6 3 Oder polls

Monthly archive

March JD07 {4)

Btxk spcaftc settings

Ust-rsptoft vtettKy settnps Rtfe LpenDc MsibMy swings

Show Hock for specific rotesi hrf anonymous uw p authenticated use

► Poll—Provided by the Poll module that is part of Drupal.

► Contact Jesse—Like Downloads, this is a user-created block. Unlike Downloads, it is not just text; it is HTML that provides links to a site-wide contact form as well as to a Webform.

► Books—A user-created block that contains HTML. The difference here is that the HTML was generated by and contains links to its associate's site.

As you can see, blocks have relatively few limitations, particularly because if all else fails, you can write HTML code. You will find a variety of blocks in Drupal and its contributed modules. Functionally, blocks fall into several categories:

► Basic functionality—These Drupal-provided blocks implement log in, search, and so forth. Primary and secondary links, as well as menus, are in this category; they are discussed in Hour 21, "Working with Menus."

► Dynamic blocks—Automatically updated by Drupal. They can provide up-to-date and changing information to your users with no effort on your part other than placing the block. Example are New Forum Topics, Active Forum Topics, Archive List, Recent Blog Posts, Recent Comments, Latest Image, Random Image, Popular Content, and Who's New.

► Your own blocks—Whether plain text or HTML, you can do whatever you want in your own blocks.

► View blocks—As you saw in Hour 14, "Working with Views," you can create various types of displays for your views. One of those displays is a block display. This means that you can create your own block from a view and display your own data.

► Contributed module blocks—This is an area of great interest to the Drupal community, and the offerings are growing rapidly. The Simplenews contributed module which is used to construct newsletters in Hour 12, "Using Blogs and Newsletters" installs a block that people can use to sign up for newslettters, for example.

"Search the modules pages for the keyword "advertising" to see some powerful, useful, and even profitable blocks and modules.

0 0

Post a comment