emessage Simple alternative/ notification messages

  1. Requirements
  2. Usage

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

2 0
5 followers
428 downloads
Yii Version: Unknown
License: BSD-2-Clause
Category: User Interface
Developed by: André Couto
Created on: Jan 1, 2014
Last updated: 4 years ago

Downloads

show all

Related Extensions