1. Go to this page and download the library: Download arif-rh/ci4-themes 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/ */
arif-rh / ci4-themes example snippets
namespace Config;
class Adminlte extends \Arifrh\Themes\Config\Themes
{
public $theme = 'Adminlte';
// you can overide other properties as your need
}
use Arifrh\Themes\Themes;
// inside your controller
$config = config('Adminlte'); // your custom theme config
Themes::init($config);
addCSS(string|array $css_files)
// 1. using string (for single css file)
Themes::init()
->addCSS('style.css');
// 2. using string, separated by comma (for multiple css files)
Themes::init()
->addCSS('base.css, style.css');
// 3. using array (for single or multiple css files)
Themes::init()
->addCSS(['base.css', 'style.css']);
addJS(string|array $js_files)
Themes::init()
->addJS('script.js');
// or
Themes::init()
->addJS(['script.js', 'order.js']);
// or use with addCSS method
Themes::init()
->addCSS('checkout.css')
->addJS(['script.js', 'order.js']);
// for example, default welcome_view in CodeIgniter4 can be render like this
// we useFullTemplate because welcome_message contains full html and body tags
Themes::init()->useFullTemplate();
Themes::render('welcome_message');
// you can manage your header, main template and footer in theme
// then you can render any view like this
Themes::render('dashboard')
Arifrh\Themes\Themes::renderCSS();
Arifrh\Themes\Themes::renderJS();
setPageTitle(string $page_title)
+HTML
<title><?= $page_title
setVar($key, $value)
Themes::init()->setVar('page_title', 'Welcome Page');
// same as
Themes::init()->setVar(['page_title' => 'Welcome Page']);
// same as
Themes::render('view_name', ['page_title' => 'Welcome Page']);
init(\Config\Themes $config = null)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.