Practical Plone 3: A Beginner's Guide to Building Powerful Websites
上QQ阅读APP看书,第一时间看更新

News items

As you have seen, Plone sites have built-in sections called portlets, which display short listings of additional content. The news items that we will create will take advantage of this concept. Once your news item has been created and published, it will be available to the users of your site, directly from the portlet. By clicking on the item listed in the portlet, the user is taken to the full news item.

News items

Creating a news item

You can create news items from anywhere that the site administrator has enabled this capability. You can find out if this is the case by clicking on the Add new… link and seeing if the option News Item is available in the drop-down list, as shown in the following screenshot:

Creating a news item

After you choose the News Item option, you are taken to the following page, to create the item:

Creating a news item

This will look the same as you saw in the chapter on creating pages. Just as with pages, you must provide a Title, and you should also add a Description for your news item. The Description field will be helpful to your site visitors, because once your news item is available, moving the mouse over the news headline in the portlet will show the description text, as shown in the following screenshot:

Creating a news item

The body text can be created using the graphical HTML editor, and the HTML editing functionality that you learned in Chapter 4 is available to you. Formatting and linking your News Item is exactly the same as for page creation.

Unlike pages, news items also include fields for a related image and a caption:

Creating a news item

When a user clicks on the main News navigation tab, they will see a listing of all of the news items. Clicking on (for example) Plone Conference in Italy takes the user directly to this page within the site. The following screenshot is an example of what a news item looks like when displayed within the news section. By default, Plone also makes this content available via a RSS feed, or you can send a news item to someone via an email message.

Creating a news item

When the user clicks on the Read More… link he or she will be taken to the full article:

Creating a news item

As you can see, the item itself is very similar to a regular page, with the exception that an image that is included. The image itself can actually be larger in size than the size shown on the page. The user can click on the image to view the image actual size. Plone dynamically resizes the image to better fit it within the context of the article. However it is always a good idea to resize your images before uploading them to your site.

If you have editing (or more powerful) rights to the news item, you can revisit and edit the news page, as well as look at any revisions that have been made it it (by yourself or by other users). If necessary, you can revert the news item to a previous version from the history section.

Creating a news item

The History section shown in the preceding screenshot is available for all content items created by you or by others. This functionality is covered in more detail in Chapter 7. This functionality is especially helpful when more than one person is collaborating on a piece of content.

The news folder

In the default setup of Plone, one of the navigation tabs is News. The News folder contains a default Collection item, which automatically generates a listing of news items located anywhere on your site.

Collections will be covered in more detail in Chapter 6.

The news folder

While you are in the News section, if you look at the Add new… drop-down option, you will see that the default is to have only News Item available for posting in this section.

The news folder

The RSS feed link is an available option for allowing visitors to subscribe to the News section of your site. Without any coding on your part, News content is RSS enabled! Users of your site can stay up-to-date as and when new content is added.

The following screenshot shows what it looks like when you subscribe to the news section in Firefox 2.x:

The news folder

Events

Events are another basic content type in Plone, and share many of the same basic fields as news items and pages.

The events folder

A default Plone site has an Events folder. Similar to the News folder discussed above, this contains a collection that lists all of the events created within the site.

Creating events

To add an event within the Events section, click on Add new… and choose Event from the drop-down list.

Creating events

As noted in the tool tip, Event items are linked to the Calendar Portlet.

The following is a list of fields within the Event content type that are different from what we have seen so far for pages and news items:

  • Event Location: Adding content in this section can assist your search engine, and give more context to your event.
  • Event Starts (Mandatory): Events are meant to have a beginning and ending time and date.
  • Event Ends (Mandatory): See Event Starts (Mandatory), above.
  • Attendees: This can be helpful for showing who is participating. The search engine can also pick up on names entered here.
  • Event Types
    • Existing Categories: This gives you the ability to add keywords that can be used for site collection criteria
    • New Categories: Use this if you need to include the existing categories
  • Event URL: Link to additional information.
  • Contact Name
  • Contact E-mail
  • Contact Phone

The following screenshot shows how the fields are presented within Plone:

Creating events

After the section for the event body text, you will see the following fields:

Creating events

As noted above, apart from the Title, only the start and end dates of the event are mandatory. Plone lets the editor decide if any of the other items that are typically associated with an event should be filled out.

The following is an example of an event that has been filled out with all options complete:

Creating events

Most of what is shown in the preceding screenshot is self-explanatory, with the exception of the What option, which can be specified via the Categories tab.

Handy, out of the box features include the ability to import a calendar item into either an Apple iCal calendar or Microsoft Outlook. You can also send a link to this page to someone via email, or print the event details:

Creating events

Using the vCal and iCal links

When you click on the vCal icon or link, you get the following pop up (in Firefox):

Using the vCal and iCal links

You can choose to either open this file, or save it to disk. On choosing Open, or on double-clicking after downloading, the file opens in an Outlook form. You can make additional edits to the event details, or just save it to your calendar.

Using the vCal and iCal links

After saving the event, it is added to your Outlook calendar.

The same type of functionality is available to users of Apple-based computers who use the Apple Calendar, when the iCal option is selected.