官术网_书友最值得收藏!

Content as fields

We sometimes tend to think of content as a big block of body text, but content can be stored as discreet fields so that important elements can be easily accessed and properly formatted:

You can see the same content in this form as you did on the page. However, here you also see the fields that hold that content. The content title is in a field labeled Title, and the main text is in a field labeled Body. There are two additional fields that are not being used by this particular piece of content: a field for categories, labeled Tags, and one that is used for attaching an image to the content, labeled Image.

By having a Title field and a Body field, both the user and Drupal understand that the information in each is separate from the other. This doesn't mean that they cannot be displayed together, but there are many reasons why we may want to be able to differentiate them.

For example, when this content was displayed on the homepage, the title and the body text were formatted differently. Another example is that we might want to have Drupal provide us with a list of content titles. In both examples, it is important for Drupal to be able to determine which part of the content is the title. If all of the content in the piece was thrown together, there would be no way for Drupal to know where the title ends and the body text begins. Having them in separate fields removes any ambiguity.

So, we have seen what the content looks like when separated into separate fields. But where do the fields come from? How does Drupal know which fields to offer to receive our input? Let's take a look at that next.

主站蜘蛛池模板: 嘉兴市| 竹溪县| 青河县| 河北区| 册亨县| 渑池县| 荃湾区| 南澳县| 定边县| 洛阳市| 茌平县| 塔城市| 万宁市| 高清| 湖北省| 威海市| 清远市| 谢通门县| 获嘉县| 洪湖市| 漠河县| 景宁| 惠安县| 鄄城县| 威海市| 炎陵县| 余干县| 卫辉市| 芜湖县| 台安县| 伊金霍洛旗| 肇庆市| 茂名市| 佳木斯市| 定州市| 石泉县| 休宁县| 鹿泉市| 连平县| 正定县| 葫芦岛市|