Welcome Guest, Not a member yet? Register   Sign In
Bays - Easy "widgets" for your views
#3

(06-01-2015, 05:53 AM)frocco Wrote: How do I install this? Tried composer install and nothing happened.

At the command line, in the project root where your composer.json file is (per packagist.org):

Code:
composer require 'myth/bay:1.0-beta1'         // or
composer require 'myth/bay:dev-develop' // for develop branch

This will install it to your project.

Then make sure that CodeIgniter is setup to use Composer's autoloader by editing config/config.php:

Code:
$config['composer_autoload'] = 'vendor/autoload.php;

Then you need some way to instantiate the class and make it available to your views. For almost all of my projects, I have some form of setVar() method that allows me to collect data to be passed to the view, but you could do it within a standard $data array, also. Something like this in your controller's method:

Code:
$data['bay'] = new \Myth\Bay\Bay( new Myth\Bay\CI3Finder() );
$this->load->view('some_view', $data);

At this point, $bay is available in your views for you to use however you would like. See the Readme for more information.
Reply


Messages In This Thread
RE: Bays - Easy "widgets" for your views - by kilishan - 06-01-2015, 06:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB