emessage

Simple alternative/ notification messages
5 followers

Its use is pretty simple: just install it.

Requirements

Yii 1.1 or above(tested on version Yii v1.1.14)

Usage

How to use this extension:

Installation:

1 - Copy the files into your extension-folder and Import the component - Edit (../protected/config/main.php):

// application components
'components'=>array(
...
    'msg' => array(
    'class' => 'application.extensions.emessage.EMessage'
    ),
...

2 - In action - example:

if(empty($model->field)) // failure
{
    Yii::app()->msg->postMsg('error', 'Empty not allowed!');
    Yii::app()->msg->saveMsg();
    $this->render('update',array('model'=>$model)); return false;
}
 
if($model->save())
{
    Yii::app()->msg->postMsg('success', 'Success message!');
    Yii::app()->msg->saveMsg();
    $this->render('update',array('model'=>$model,'id'=>$model->id));
}
 
if($model->save())
{
    Yii::app()->msg->postMsg('note', 'Ops! message...');
    Yii::app()->msg->postMsg('error', 'Empty not allowed!');
    Yii::app()->msg->saveMsg();
    $this->redirect(array('index'));
}

3 - Print messages in layout/view( or... - example:

Yii::app()->msg->getMsg();

- Basic usage:

Yii::app()->msg->postMsg('success', 'Testing... 123');
Yii::app()->msg->printMsg();

successnoteerror

Be the first person to leave a comment

Please to leave your comment.

Create extension
Downloads