Structuring Your Content
Date: 12-05-2007 15:18 Views: 5845
Content is the focus of everything you do with MonkeyCMS - the creation and layout of content are what differentiates your site from another. This tutorial will describe how to define your content and how content is structured (the content hierarchy). The hierarchy is only a description of how content is related - even with a hierarchy in place, it is only ever optional.
Planning Your Content
This tutorial will cover the creation of the content structure hypothetical book website.
On a basic level, we may want to have book News and Reviews - so we'd have a Definition for each to describe what each of these types of content might contain. However, in our example, it may be useful to group news and reviews by Author. The Author will act as a 'parent definition' for the News and Reviews definitions.
This is a basic hierarchy for your content. The Author has children, while News and Reviews both have siblings and a shared parent. Any piece of content will also have the basic details of any parent, child or siblings available to display through a content template.
Creating Your Definitions
As the parent, it makes sense to create the Author definition first. To do this, browse to Content > Definitions > Definition Management, enter the name Author in the provided field under the Add Definition label and click Go.
The next screen allows you to define different types for your content. We'll leave things as they are for the Author definition, so click Go. (note: you can return to this screen at any time by selecting your definition to edit and click the Edit Content Types link).
The final screen in this process allows you to decide what exactly makes up your content. You can choose to have as many or few of the standard fields as you need and can also add further fields if necessary. There are also four custom fields stored against the main content.
The only three things we'll need for the Author is the Title (the Author's name), Text (some information on the Author - e.g a biography) and the Image. Remove the ticks in the checkboxes from all of the other fields. The next thing to do on this screen is decide how you want your edit index displayed - this may differ for different types of content - in the case of the Author, an alphabetically filtered index would be most appropriate so select Alpha from the Edit Filter dropdown. Finally, there wouldn't be much point in having the Author in your RSS feed, so remove that check and it would be useful to have Author's to appear in search results so ensure that is checked.
Click on Save Definition.
The final page should look like this:
The next step is to modify the News definition for your needs. Again, browse to Definition Management and select the News definition from the list. This time, it would be useful to include the Featured Text element along with the Title, Image and Text - the reason for this is to give us an 'extract' field to present on the front page of your site along with the title. For news, it is often easier to filter your Edit index by date, so ensure Edit Filter is set to Monthly. News is an appropriate content type for an RSS feed, so ensure that is checked along with the Search results. Finally we need to set our Parent Definition to the Author definition we created earlier, so select Author from the Parent Definition dropdown.
Save your changes.
The resulting definition should look like this:
For Reviews, we'll again keep things simple - we need to have the Title, Index Title, Text, Featured Text and Image elements available. In addition, we'll make use of two of the miscellaneous fields this time - Rename Miscellaneous String 1 to ISBN and ensure it is enabled, and then rename Miscellaneous Float to Price and ensure it is also enabled. The Edit Filter would be best set to Alpha and select the Author definition from the Parent Definition dropdown. Reviews should be both Searchable and included in the RSS feed. Once everything is set, click Save Definition.
The final screen should look like this:
Assigning Content as a Parent
Once you start adding content to your site you can start linking it together with the structure you have created above.
Add a couple of Authors and ensure they are uploaded to your site. Once they are online, browse to the Add Review screen and fill it in as you would. You'll see an 'Author' field in your content with an associated button. Click the button and you'll be presented with a popup (shown below) allowing you to find the Author from your existing content. To display all authors, enter the search term % and click search, or enter a partial name. Select the correct author from the list and click Set Parent. The Author field will now be populated with the parent you selected.