PyroCMS Streams

What are Streams?

PyroCMS uses the term Streams for storage of data in a database table. Don't panic, you don't need to know about databases, just think of a table that has column headings and rows containing data. PyroCMS has interfaces that allow you to define what each column is called and can contain (like text, a number, an email address etc). Usually, you don't need to use this set-up process for Streams as they have already been defined by the Admin user. All you need to know is how to Add, Edit and Delete entries (rows) in the Stream.

Access to Streams

In the Admin pages, from the menu select Content->Streams



You now see the Streams (database tables) that have been defined and are in use in the system.

Beware....  Only use the Manage option if you know what you are doing. Changing the definition of fields that make up a stream or the stream definition itself can cause the loss of data or stop the pages from correctly displaying data.

Use the Entries option if you want to edit an existing entry in the data.

Use the New Entry option if you want to add a new entry in the stream.

More soon...

Usage of Streams

PyroCMS provides a way to utilise the data held in a stream directly in a Page layout. The methods provided however do not always provide a simple way to control and use the data in a way that is required in the Page layout. A better solution is for the Admin user to write low-level code in a plugin that can extract, manipulate and format the data to exactly what is required for a page. This does mean that the plugin is very specific to the Page requirements. The plugin is accessed by inserting a Tag into the Page layout.

The syntax for the tag to access a plugin is simply:

Each plugin can have many functions that are accessed by their function_name, and the function can be passed many parameters (or none) that decide how it behaves.

Stream Entries

Each entry in a stream is simply a list of fields that require a defined input. For example, the fields may be Title, Name, email address, telephone number, etc. The fields may have a type that restricts the values you can enter, thereby providing validation for the input. A field can also be a text area that is either pure text (no formatting ability for the content) or a WYSIWYG editor area where you can enter what would be normal page content.

If a field has a * against the name of the field, it indicates that the field is mandatory, you must provide some input.

Each field generally as an explanation above the entry area that should help you determine the input required. For example. the News stream starts with these fields:

Special case

Normally each stream is an independent set of data. The exception in PsM are the "Events : Regular" and "Events : Diary" streams. As the Events: Regular holds events that occur on certain days of the week, the stream has fields that control if entries should be added to the Events: Diary automatically. This process is done by a system task that runs every night at midnight.

All that is need for this task to work is that the following fields are set at the end of the entry in the "Events : Regular" stream:

  • Events to Diary simply controls whether you want this event to produce events in the diary or not.
  • Event Diary Weeks determines how many future weeks events are maintained in the "Events : Diary" stream beyond "today's" date (when the overnight task is run)
  • Event Regular Diary body is the content that will be used in the entry generated in the "Events : Diary" entry, and then used on the Events Diary page when it is viewed.