[[[[Add description]]]]
This lesson has been designed for Drupal 5.x, since at the time of writing not all necessary modules were yet available for Drupal 6. When possible, this lesson will be upgraded with any additional details needed for Drupal 6 compatibility.
This lesson will use a sample CCK Content Type called "Article". You can create or import this Content Type to follow along (grab the import code from below ***ADD CODE***), or else simply apply the concepts to your own content types. Before beginning on your own home page, it is important that you fully develop the Content Types you will be using for your site (or at the least, those that will be involved with the home page in any way). Since your Content Types make up the bulk of what your home page will actually consist of, it's important to have them all sorted out before dealing with your home page. If you'd like some guidance on setting up your own Content Types and fields before proceeding with this lesson, please visit the following resources:
-
-
(your Content Types may have considerably more fields, or additional types such as Image fields)
You might wonder why you need the teaser_title and teaser_text fields, instead of just using Drupal's own node title and automatically generated teaser text. On a more complex home page, it becomes important to ensure that certain blocks of content will always consistently fit into the specific amount of space that's been allotted to them (enforced during entry of the content with the field's "maximum length" setting). On more professional sites, a short "synopsis" of each item of content is generally preferable to an auto-generated chunk of text cropped off of the beginning of the full content's page, which is Drupal's default behavior. Having a separate teaser_title is more optional, but if you choose to have one, will allow you to set a different or shorter version of the title to more easily fit into the confines of the home page, while still allowing you to have a full length title for the actual page. Setting up dedicated text fields in CCK for the teaser and title helps to accomplish all of these purposes.
If you prefer to go "all out" with your Article content type, here are some additional field options to choose from (including these just for your reference/ideas - they are not used in the lesson):
When your Article content type is fully completed, your editor/staff will just need to click Create Content -> Article, and be presented with exactly all of the fields they need to fill out and images to upload to completely and correctly produce an article (with no coding - other than maybe light HTML for the article formatting itself unless you give them a WYSIWYG editor).
I'm assuming you want to be able to select various articles/pages from the site to feature in the middle row of the home page, in a specific order (the top one being the Cover Story). The way to do that is to create a View that has its order controlled by a Node Queue. To make your Node Queue, go to admin/content/nodequeue/add/nodequeue . Enter a title (e.g. home_articles_queue), Queue size of 4, and for Type choose Article (assuming you've made the CCK type). You might also like to check "Reverse in admin view", as this will cause queue items to drop from the bottom of the list rather than the top as new items are added, which may or may not make better sense to you (if you do this, you'll also probably want to adjust the NodeQueue: Queue Position sort criteria option to "Descending" in the View you'll make in the step below). Node Queue also adds a new tab to pages of the content type you selected in the previous step (Article), and you can click that tab from any page and add the page into the queue. You can then reorder the queue as you like by going to admin/content/nodequeue and clicking on the View option of the queue you want to adjust (and you can also use the search field to add additional content directly to the Node Queue).
Next comes the View that is ordered according to the Node Queue. You can make your own View and add the Node Queue "Filter" and "Sorting" options, or you can use the default nodequeue View that is generated for each nodequeue as a starting template to customize. Go to admin/build/views and look down in the "Default Views" area for a View called "nodequeue_1". Click the Add link to the far right and you'll call up a Views page containing the default options for that View. Change the name some something else (e.g. home_articles), uncheck Provide Page View. Scroll down to the Block options - ensure List View is selected, remove the title, set the # to 4, and uncheck More link. Next add the needed fields from your Article content type (e.g. at least the teaser-image, or other fields if you decide to make those as text/images/css). For Filters, add Node: Published (set to yes), and Node: Type (set to Article). When you're finished, save the View.
To add a View to Panels you first need to specifically tell Panels which Views you want to make available for it to use. To do this, go to: admin/panels/views, choose the name of the View you just created above from the selection menu, and press Create panel view. Copy and paste the View's name into the Panel view title field - you can leave all the other settings as default - scroll down and submit the page.