1. Go to this page and download the library: Download slaxweb/ci-basecontroller library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
slaxweb / ci-basecontroller example snippets
class Contrlr extends \SlaxWeb\BaseController\BaseController
{
public function showView()
{
// nothing, that's enough
// base controller will load application/views/contrlr/showview/main.php view file
// if the controller is located in a sub-dir, sub-dir is also }
public function viewWithData()
{
$this->viewData = array("name" => "value");
}
}
class Contrlr extend \SlaxWeb\BaseController\BaseController
{
public function injectLanguage()
{
// you're done, default view is loaded with default language and its prefixed language strings.
}
public function noLang()
{
$this->langFile = false;
}
public function diffLangFile()
{
$this->langFile = "Diffrent";
}
public function diffPrefix()
{
$this->langPrefix = "custom_prefix_";
}
public function nonDefaultLanguage()
{
$this->language = "german";
}
}
class Contrlr \SlaxWeb\BaseController\BaseController
{
public function defaultLang()
{
}
}
class Contrlr extends \SlaxWeb\BaseController\BaseController
{
// DEPRECATED
public function template()
{
$this->head = "head/view";
$this->foot = "foot/view";
}
// DEPRECATED
public function noTemplate()
{
// if a template is already loaded, you can disable it
$this->ant your method or whole controller to have a specific
layout file you can set it to the layout property
$this->layout = "layout/view";
}
}
// use controller or application specific layout
$this->layout = true;
// use custom layout
$this->layout = 'layout/myLayout';
class Cntrlr extends \SlaxWeb\BaseController\BaseController
{
// Autoload models Model1_model and Model2_model
public $models = array("Model1", "Model2");
public function someMethod()
{
// now just use the model:
$this->Model1->modelMethod();
$this->Model2->modelMethod();
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.