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')); }
public function testDisplaySuccessReturnsExpectedString() { Messages::success('Message One'); $result = Messages::display(); $this->assertRegExp('/\\<ul class="success">/', $result); $this->assertRegExp('/\\<li>Message One\\<\\/li\\>/', $result); }
<ul class="nav navbar-nav"> <li id="about-tab"><a href="<?php echo $this->uri('/'); ?> ">Home</a></li> </ul> </div><!--/.nav-collapse --> </div> </div> <div class="container page"> <div class="row"> <div class="content"> <?php echo \werx\Messages\Messages::display(); ?> <?php echo $this->child(); ?> </div> </div> <!--//row--> </div> <!--// page--> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<?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();
public function index() { Messages::success('Werx Installation Successful!'); $this->template->output('home/index', ['heading' => 'Congratulations, it worked!']); }