Visit the official documentation of CodeIgniter for advanced information.
<?phpnamespace Config;$routes = Services::routes();$routes->get('my_plugin', 'My_Plugin::index', ['namespace' => 'My_Plugin\Controllers']);$routes->get('my_plugin/(:any)', 'My_Plugin::$1', ['namespace' => 'My_Plugin\Controllers']);$routes->post('my_plugin/(:any)', 'My_Plugin::$1', ['namespace' => 'My_Plugin\Controllers']); //will be required if any data need to be posted
<?phpnamespace My_Plugin\Controllers;use App\Controllers\Security_Controller; //access main app's controllerclass My_Plugin extends Security_Controller {//your methods}
<?phpnamespace My_Plugin\Controllers;use App\Models\Crud_model; //access main app's modelsclass My_Plugin_Model extends Crud_model {//your methods}
Calling the model:
$My_Plugin_Model = new \My_Plugin\Models\My_Plugin_Model();
<?phpnamespace My_Plugin\Libraries;class My_Plugin_Library {//your methods}
Calling the library:
$my_plugin_library = new \My_Plugin\Libraries\My_Plugin_Library();
<?php$lang["my_plugin_show_staff_members"] = "Show staff members";
Then you can use the RISE's app_lang("my_plugin_show_staff_members"); to retrieve the language value. Add all language directories as like the main app if you wish to support all language for your plugin.
$view_data['foo'] = "bar";//$this->template->rander() function will show the view with left menu and topbar by default.return $this->template->rander('My_Plugin\Views\folder\index', $view_data);//$this->template->view() function will show only the view, but here you'll get the login user's info as $login_user variable if any login user existsreturn $this->template->view('My_Plugin\Views\folder\index', $view_data);//default view() function of CIreturn view('My_Plugin\Views\folder\index', $view_data);
helper("my_plugin_general_helper");
require_once(PLUGINPATH . "My_Plugin/ThirdParty/library_folder/vendor/autoload.php");
<link rel='stylesheet' type='text/css' href='" . base_url(PLUGIN_URL_PATH . "My_Plugin/assets/css/my_plugin_styles.css") . "' />
PLUGIN_URL_PATH. "My_Plugin/files/my_plugin_files/"