Example #1
0
 public function __construct()
 {
     parent::__construct();
     // Set our default template.
     $this->template->layout('layouts/default');
     // Set some variables for all views.
     $this->template->page_title = 'Werx Skeleton';
     // Load our primary config file.
     $this->config->load('config');
     // Initialize error handling.
     $this->initializeErrorHandler();
     // Load the messages library, passing in an instance of the session.
     Messages::getInstance($this->session);
     // Set the default decorator to twitter bootstrap.
     Messages::setDecorator(new \werx\Messages\Decorators\Bootstrap());
     // Load our database config file. Don't forget to edit config/database with your connection info.
     #$this->config->load('database', true);
     // Initialize our database.
     #DB::init($this->config->database('default'));
 }
Example #2
0
 public function testSetSimpleListDecoratorReturnsCorrectClass()
 {
     Messages::setDecorator(new Decorators\SimpleList());
     $decorator = Messages::getInstance()->decorator;
     $this->assertInstanceOf('\\werx\\Messages\\Decorators\\SimpleList', $decorator);
 }
Example #3
0
<?php

use werx\Messages\Messages;
$vendor_dir = dirname(dirname(__FILE__)) . '/vendor';
require $vendor_dir . '/autoload.php';
// Get an instance of the Messages class.
Messages::getInstance();
Messages::error('Oops, something bad happened');
Messages::info('Nothing big, this is just a informational message.');
Messages::warning('A little more serious than info, but not quite an error.');
Messages::success('Hooray! This is a success message');
Messages::success('Here is another success message.');
print_r(Messages::all());
Messages::error('Oops, something bad happened');
Messages::info('Nothing big, this is just a informational message.');
Messages::warning('A little more serious than info, but not quite an error.');
Messages::success('Hooray! This is a success message');
Messages::success('Here is another success message.');
print Messages::display();
Messages::setDecorator(new \werx\Messages\Decorators\Bootstrap());
Messages::error('Oops, something bad happened');
Messages::info('Nothing big, this is just a informational message.');
Messages::warning('A little more serious than info, but not quite an error.');
Messages::success('Hooray! This is a success message');
Messages::success('Here is another success message.');
print Messages::display();