sfFlashMessagePlugin - 1.0.1

This helper plugin displays user flash messages using very nice looking jQueryNotifyBar

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfFlashMessagePlugin

Description

This helper plugin displays user flash messages using jQueryNotifyBar plugin. Its displays very nice looking notify bar which pops from the top and disappear after defined amount of time. Customization is possible.

This plugin uses awesome jQuery library and jqueryNotifyBar plugin by Dmitri Smirnov.

Installation

$ symfony plugin:install sfFlashMessagePlugin
$ symfony cache:clear

Usage

Place use_helper in your main layout template:

<?php use_helper("Javascript") ?>
<?php use_helper("sfFlashMessage") ?>

and then place helper itself (anywhere inside the body tag):

<?php echo flash_message() ?>

Define flash message in your ations.class.php

$this->getUser()->setFlash('notice', 'This is notice');

Above will display green popup (pops from the top) with 'This is notice' text. It will disappear after 2.5 seconds.

$this->getUser()->setFlash('error', 'Error !');

Above will display red popup with 'Error !' text. It will disappear after 5 seconds.

If there is no flash message for the user, nothing will be displayed.

Customizations

You can customize delay time after which popup disappear (in miliseconds).

<?php echo flash_message(5000) ?>

Which means 5 seconds. Error messages displays twice as long as notice messages (10 seconds for this example).

You can also customize look and feel of notify bars by defining your own css. (See css plugin dir).

Notes

Plugin works best with sfJQueryReloadedPlugin.

Plugin uses jQuery so its not compatible with sfProtoculousPlugin (which has to be disabled).