Recipe 4: Adding a Header to your View
Note
Ingredients
Completed Recipe 3
You can easily add custom text or graphics above or below your view content, using the Header and Footer fieldsets. We will add a brief description at the top of the Swim Groups page.
Go to
http://YOURSITE.com/admin/build/views
. Your swim_groups view is now included in the list of views.Click on swim-groups in the URL column.
Open the Page fieldset, and then open the Header fieldset contained within it.
Enter the following header text:
Swimming is a great sport which exercises the whole body. Swim lessons are available for all ages and ability levels. Note: A parent or guardian must accompany children under 5 when in the water.
Open the Input format fieldset contained within the Header fieldset. Note that Filtered HTML is selected. See the Recipe notes if you would like to expand the list of available HTML tags.
Scroll down to the bottom of the Edit view page, and click on Save.
Enjoy the view.
Recipe notes
The Header fieldset (along with the Footer and Empty Text fieldsets) each contain Input format fieldsets. Input format filters will modify the display of text that has been entered by users (Input format filters are not connected to the filters fieldset that we described in Recipe 3). When a user enters text or code into a Drupal site, the text is saved in the database exactly as typed. Next time we view the text, however, it may not look exactly the same—some text and tags may not appear. To modify the list of allowed tags, visit the Site Configuration | Input Formats page, at:
http://YOURSITE.com/admin/settings/filters
.The most common reason for using these filters is to protect your site from malicious users, or even from users who don't intend to be malicious but who exhibit bad form. The Input format ensures that scripts will not be run, and that badly formed HTML will not break your site's layout. Filtered HTML is the name of one of the default Input formats.
A terrific article by Robert Douglass offers helpful information on input filters at: http://www.lullabot.com/articles/drupal_input_formats_and_filters.