Personal tools
You are here: Home Documentation Tutorials Creating a Collection
Navigation
 
Document Actions

Creating a Collection

Note: Return to tutorial view.

How to create a collection

Overview

An Introduction to Collections

A Collection in Plone works much like a report or query does in a database. The idea is that you use a Collection to search your website based on a set of Criteria such as: content type (page, news item, image), the date it was published, or keywords contained in the title, description, or body.

Let's say you have a large catalog of photos and maps on your website. You can easily display them all at once by creating a hyperlink to the folder they're stored in. You could even create different links for subfolders if you've organized things that way. However, if your images and maps were spread out over the site in many folders this would quickly become cumbersome. Also, there is no way with normal folders to display different content, from different parts of your site based on things like:

  • keywords in the title
  • date of creation
  • author
  • type of content

The need for showing content in a variety of dynamic ways has given rise to Collections (formerly known as Smart Folders, or Rich Topic in older versions of Plone). Collections do not actually contain any content items themselves in the same way that a folder does. Instead it is the Criteria that you establish which determines what content appears on each Collection page.

Common applications for Collections are:

  • News Archives
  • Event Archives
  • Photos Displayed by Date Range
  • Content Displayed by Keyword

Before you learn how to create your own Collection, go on to the next page to see how they work in practice.

Examples of Collections

This page shows some Collections in action so you can get an idea of what they do.

To start understanding just what Collections do, let's explore some existing ones that will search this site for:

 

Click on any of the above links to see a Collection display its results. These will open in a new window, so you don't lose your place in this tutorial. When you're finished viewing these Collections, go to the next page to learn how to craft your own!

Creating Your Own Collection - Part 1

Learn the skills to make your own collection

To start with, I'm going to show you how to create a Collection that will display all News Items found on your website. This is one of the most common Collections found on a site, and you may in fact already have one on your site.

  1. Find a place on your site to keep your Smart Folders.
  2. Click on the Add to Folder tab and select Collection from the list.
    • Notice that you're now working in the Edit tab for this content item. This screen is for naming the Collection page and choosing display options.
  3. Give your Collection a Title and Description.
  4. You may now choose to Limit Search Results (optional)
    • Limiting results only limits the number of results per page, not the total number of results found
  5. You may also choose to display results in a table. This is optional (the default display is a vertical list) so you can play around with this if you like.
  6. Push Save to create the Collection.

 

This completes the first part of building a Collection. Go on to the next page to learn how to set the search parameters on your new Collection.

Creating Your Own Collection - Part 2

Learn about the Criteria tab and how to set search parameters for a Collection. Things get a little deep here but be patient, experiment, and take the time to learn the techniques described here.

At this point the Collection exists, but it doesn't do anything because you have to give it some criteria to tell it what to do. As you might expect, click on the Criteria tab to finish your Collection set up.

Notice that there are two boxes, so to speak. One is labeled Add New Search Criteria, and the other is labeled Set Sort Order. Ignore Set Sort Order for the moment.

Under Add New Search Criteria are two drop-down menus called Field Name and Criteria Type. Click on the Field Name menu to see all the choices. To create a News Collection, choose Item Type.

item-type-criteria creation-date-criteria  

Two examples of different Field Names - For this tutorial, choose Item Type

 

You may notice that when you select Item Type, that there is only one choice for Criteria Type. That is because you must push Add to create the search criteria, then you can select the exact content type that your Collection will search for. Other Field Names such as Creation Date will give you more than one Criteria Type to choose from. In the example on the right, you can choose a Creation Date range or relative date.

After pushing the Add button, the top of the Collection screen should look like this:

 

item-type-value

 

To delete a criterion, use the check box in the first column and push Remove.

 

 

 

 

 

 

 

 

 

 

 

From the list under Value find News Item and select it. You may select several Content Types from this list by holding down the Control button when you click on content types. When you're finished with this, push Save.

You're now looking at three boxes on the screen. The top box is the criterion you we're just working on. The second box allows you to Add New Search Criteria. This is how you could, for example, search for News Items (criterion one) created before July 1st (criterion two). The third box is Set Sort Order if you wish to change the order the results display in.

Note: All the above only works if you actually have News Items on your Plone site. If you do not, try changing the Item Type to Page. That should show you at least some results.

Conclusion

Some final words about using Collections and where to find more information

So now that you've gotten familiar with creating Collections, you might be wondering how to use them. The most obvious way for your site visitors to find a Collection is to simply create a link to it from a page. Remember the examples you saw on page two? It just as easy as that.

The results of a Collection can also be displayed in a Portlet - a great way the leverage the power of Collections.

You can also nest Collections within Collections. That will result in the message Contained Collections and any subfolders listed there at the bottom of a Collection view. You can access this functionality by using the Subfolders tab in the task bar of a Collection. These are useful for things like a News Item Collections that contains all News Items less than one month old, and a subfolder for News Items older than one month (in effect creating a news archive page). You can really create some sophisticated ways to organize information on your website using Collections, multiple criteria, and subfolders.

 

Still Stumped?
If you've still got questions about Plone, here are your best bets for finding out more:
 

All content in this site distributed under the Creative Commons "Attribution-NonCommercial-ShareAlike" license unless otherwise noted.

Powered by Plone CMS, the Open Source Content Management System