Memorable view
DrupalCamp : Views
Drupal is modular. A basic Drupal site is quite capable. Modules extend basic Drupal sites with optional functionality. Enabling views makes Drupal sites exciting!
At first blush, views can intimidate. Fear of views is common; even Drupal architects must develop their love for views … and there's so much to love!
The Basics
Hey! You! … with the standard Drupal installation! Yes! I'm talking to you. You don't have views. It's a module and you can only administrate views if the Views module is installed. So? Why are you still waiting? Help is a available!
Is everybody still with me? Good! So, with the Views module available, turn it on at your site's /admin/build/modules page. What's that — "Access denied"? You didn't log in as a privileged user? Okay, use a site where you have proper authorization, and try again — better yet … use a localhost sandbox.
Check the box beside the the word ("Views"), then click before we go on.
No! My button is fake! Click the button on the module administration page. Good! Now, let's hurry along. The web site is waiting on us.
Take the helm
Don't let go of your administrative authorization just yet. You'll need it a little longer. First, look at what is already done with /admin/build/views. We're going to make that list grow (use the /admin/build/views page). Feel the power! Please! The raw majesty of the Views module is awesome, but we stay calm and resist the urge to prostrate ourselves. We'll need to see what we're typing.
Every view must have a name. Mere mortals must use letters, numbers or underscores in the View name; mere mortals cannot have View names that contain spaces. Technically, a site Views administrator can click once the View is properly named. A name, by itself, adds minimum functionality but, with a name, a View is listed at /admin/build/views.
Are we anxious for our first View? Wonderful! Let's name it hello_wyrld and have it show the phrase "Administrate responsibly" in the header region of administrative pages. Navigate to /admin/build/views/add and type hello_wyrld in the Name textarea. A description is recommended to enlighten other Views administrators. Let's use "Advises responsible site administration" in the Description textarea. It is possible to limit visibility of a view to specific roles but limitation will be unnecessary. Click now.
After saving the "Basic Information" configuration, the rest of displaying our wyrldly view will be mere tedium.
For the focus objective in this exercise, we will define and configure the block view. Find, on the "Edit view Hello_Wyrld" page, and open the "Block" fieldset by clicking it.
Inside that fieldset, make the following changes:- Provide Block
- Enable
- View Type
- List View
- Title
- Administrate responsibly
- Nodes per Block
- 1
Open the "Empty text" fieldset and type into the "Empty text" textarea. Click again — stay in the habit of regularly saving your work.
We're almost there; we only lack some filter of content before we publish our view. Open the "Filters" fieldset and select "Node: Created time" from the "Add Filter" list. Type now into the value field beside the default "Is Equal To" operator. Click because the view is ready for audience.
Going public
We administrate Blocks at /admin/build/block/configure/views/Hello_Wyrld (configure … on the same line with "Hello_Wyrld"). In the "Page specific visibility settings" fieldset of the 'Hello_Wyrld' Block page, switch to "Show on only the listed pages." and type admin and admin/* into the "Pages" textarea of the same fieldset. Click and go back to the Blocks administration page.
Change the list selectors beside "Hello_Wyrld". The default Region, <none>, needs to be changed; use header. The default Weight, 0, needs to be changed; use 10. Click . Now … look in the header.
No magic
We're done.

Post new comment