Drupal content types

What are content types, a very powerful tool to model your site

But what are content types with Drupal?


To better understand a content type think about a form, with Drupal installation by default there are these two content types:


Page: is a form with a Title and Body fields,and by default does not allow visitor comments and is not featured on the site's initial home page


Story: is a form with a Title and Body fields By default, and is automatically featured on the site's initial home page, and provides the ability to post comments.


And these are two forms, you see, just forms.


Let's say that at first you are satisfied with these two types, but after a while you would like to create, let's say a list of computers' models that you would like to present ordered by the product name or the product creation date. You will need a new content type (a form) to handle all this fields.


To begin creating and/or modifying content types you must have installed the CCK modules.

Do it, and come back here to see how to go on.. (waiting...)


Study Case: My literature page


In my page I need diferent content types adapted to a writer, so I've got these:

* Poems
* Novel
* Articles


I'm going to create a content type for Poems, so here are the needs:



    * Poems items to be their own 'content typ'' so I can create user roles just for posting poems items (when users want to post their own poems).
    * Latest 5 poems items to show in a block on the first page.
    * Separate 'poems' page that lists all poems items, most recent first, with paging (eg. show 10 at a time).
    * 'poems' page should be a menu item
    * List to show date of item and title of item, with the title being a link to the full article
    * Poems items to support 'teasers'
    * Have an Archive block on the Poems page to show list of poems items by date




* Create a content type of 'poems'
* Check the options to add, change or delete own poems items for the appropriate users or roles.
* Create a 'block' view to display poems items
* Place the block somewhere on the poems list page
* Create a 'page' view to display poems items.  You choose which menu item you want to use for this page when you create the view.
* Create an 'archive' block view to display archives by cloning the provided Archive view and changing it
* Place the archive block somewhere on your poems list page.


Create the content type 'Poems'


 So, hands on create Content type of 'poems'.


    * Login as Site admin
    * Go to Administer > Content Management > Content Types, click Add.
    * Name: Poems, Type: poems (I use all lower-case for the type), Description: Poems items.
    * Workflow settings: Check 'Published' .
    * Save the content type.


 Set up a User who can create, change or delete News items. First we'll create a new role, specifically for just working with poems items:


    * Go to Administer > User Management > Roles
    * Click on Add Role. Call it Writer (you can always delete this later if you really don't want it)
    * Click on Edit Permissions
    * Scroll down the list of permissions until you get to 'Node Module'. Check 'Create poems content', 'edit own poems content' and 'delete own poems content' then click 'Save permissions.
    * Create a user with a role of writer: Go to Administer/Users and click on 'Add User'. Type a Username, unique e-mail address password, and check the role of 'writer'.

* Add some Poems!

    * Logout of Drupal
    * Login with the User just created (role of writer)
    * Click on the 'Create content' link and create some poems items.



Please go and check now how to create Views and then come back, (waiting...)