Documentation
Session
The session plugin gives you the ability to set and read session data.
The session plugin's slug is session, so it can be used like so:
{pyro:session:function}
Functions
{pyro:session:data}
Displays or sets a piece of session data.
If this function is provided a value, it will set the session data and display nothing. If no value is provided, the value of the name provided will be displayed by the function.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| name | None | Yes | Name of the data you want to display or set. |
| value | None | No | Add a value if you want to use the tag to set data instead of display it. |
Example (Displaying Data):
{pyro:session:data name="color_preference"}
red
Example (Setting Data):
{pyro:session:data name="color_preference" value="red"}
{pyro:session:flash}
Identical to the data function, but uses flash data.
Flash data is data that is only available for the next page load, then it is destroyed.
{pyro:session:messages}
Displays a flashdata message.
PyroCMS has standardized messages to belong to one of three categories:
- success
- notice
- error
PyroCMS modules use this syntax, so if you want to display success, notice, and error messages in your theme, you can use this function.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| success | success | No | Set your own class name for success messages. |
| notice | notice | No | Set your own class name for notice messages. |
| error | error | No | Set your own class name for error messages. |
Note: messages will only display if there is flash message data to display on a page load. Otherwise, the plugin will display nothing.
Example:
{pyro:session:messages}
<div class="error">There was an error.</div>
Example (Custom Message Class):
{pyro:session:messages success="my_success_class"}
<div class="my_success_class">Success!</div>
