The Basic Page and Article Content Types
When you install Drupal 7 you automatically receive two content types that have been defined by the team who maintains Drupal core: the Basic page and Article. If you author a piece of content using the Basic page content type you will see that it provides two basic fields: a title and a body.
An author using the Basic page content type simply enters a title (a required field as indicated by the red asterisk) and the text of their content in the body field. The body field is flexible and can contain whatever the author feels like writing about. The author could:
• Write an entire book in the body field, including HTML markup (headings, tables, CSS, and so on).
• Insert pictures.
• Enter PHP code to extract information from the Drupal database and display the extracted information.
• Write a single sentence.
The Article content type is similar to the Basic page, except it offers the ability to upload a picture and define a set of tags that can be used to categorize the content (see Chapter 4 for details on categorizing content).
Like a Basic page, and Article can be used to author content about any subject, and the body area is allows for entering free form text.
While the Basic page and Article content types are perfect for general content, there will likely be cases where you want to provide some form of structure around the information that is captured. You may want to:
• Require that certain information is entered before the author submits the content item for publishing; for example the start date and time for an event, the address of the venue where the event is being held, and a link to the event on a Google map.
• Have the ability to perform calculations based on the information that is captured in a content item.
• Have the ability to sort content items by specific "fields."
• Have the ability to "filter" or restrict which content items are displayed on a page based on a value in a field.
• Enforce the structure of how a piece of content is rendered on a page; for example, you may want to display information about a book and want the title to be followed by the author, followed by the ISBN, followed by the price, followed by the description of the book.
• While you could publish all of this information in a Basic page or an Article, providing the features for sorting, filtering, making values required, calculating, and structuring how a content item is rendered on a page would be extremely difficult. Fortunately, Drupal's ability to define custom content types makes all of the above possible, and provides many more features that you will find invaluable over time.
Post a comment