- Seme Framework
- version 4.0.3
- Requirements
- Download & Install
- Configuration
- Tutorials
- URI Routing
- Constants
- Global Variables
- Model
- View
- Controller
- cdn_url
- config
- constructor
- getAdditional
- getAdditionalBefore
- getAdditionalAfter
- getAuthor
- getCanonical
- getContentLanguage
- getDescription
- getIcon
- getJsContent
- getJsFooter
- getJsReady
- getKey
- getKeyword
- getLang
- getRobots
- getShortcutIcon
- getThemeElement
- getTitle
- input
- lib
- load
- loadCss
- loadLayout
- putThemeContent
- putJsContent
- putJsFooter
- putJsReady
- render
- resetThemeContent
- session
- setAuthor
- setCanonical
- setContentLanguage
- setDescription
- setIcon
- setKey
- setKeyword
- setLang
- setShortcutIcon
- setTheme
- setTitle
- Library
- CLI (command line interface)
- Core
- Issue
- Deployment
loadCss Method
The loadCss
method purpose is for loading css file from a controller.
Basic Usage
Here is the basic usage loadCss
method from SENE_Controller class.
$this->loadCss(string $src[, string $utype]): $this
Parameters
loadCSS has 1 required parameter and 1 optional parameter.
$src
The $src
value can be an relative url by using base_url() function or using CDN url by using cdn_url() method or a plain external URL.
$utype
The $utype
value indicates the load position of css after load.
Here is the list of compatible values:
before
, its mean css will be loaded before theme.json list.after
, its mean css will be loaded after theme.json list.
Example Usage
Here is the full example for loadCss
method by using used external css resource.
$this->loadCss('https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css','before');
Relative CSS File
If want to used relatives css resource, simply use.
$this->loadCss(base_url('assets/css/font-awesome.min.css','before'));
Full Example
Here is the full example on blog.php file controller.
<?php
class Blog extends SENE_Controller {
public function __construct(){
parent::__construct();
}
public function index(){
//external
$this->loadCss('https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css','before');
//relatives
$this->loadCss(base_url('assets/css/font-awesome.min.css','before'));
//theme content and layout rendering
$this->putJSReady('home/home_bottom',$data);
$this->putThemeContent('home/home',$data);
$this->loadLayout('col-1',$data);
$this->render();
}
}