Improve asset library
This commit is contained in:
@@ -16,10 +16,9 @@
|
||||
*/
|
||||
function asset_url($type, $filename) {
|
||||
$CI = &get_instance();
|
||||
$CI->load->config('assets');
|
||||
$CI->load->library('assets');
|
||||
|
||||
return $CI->config->item('base_url') . $CI->config->item('assets_folder')
|
||||
. $type . '/' . $filename;
|
||||
return $CI->assets->url($type, $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,14 +26,46 @@ function asset_url($type, $filename) {
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $filename
|
||||
* @param array $attributes
|
||||
* @param mixed $attributes
|
||||
* @return string
|
||||
*/
|
||||
function asset($type, $filename, $attributes = array()) {
|
||||
function asset($type, $filename, $attributes = '') {
|
||||
$CI = &get_instance();
|
||||
$CI->load->library('asset');
|
||||
$CI->load->library('assets');
|
||||
|
||||
return $CI->asset->load($type, $filename, $attributes);
|
||||
return $CI->assets->load($type, $filename, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts CSS assets.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param mixed $attributes
|
||||
* @return string
|
||||
*/
|
||||
function css_asset($filename, $attributes = '') {
|
||||
return asset('css', $filename, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts image assets.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param mixed $attributes
|
||||
* @return string
|
||||
*/
|
||||
function image_asset($filename, $attributes = '') {
|
||||
return asset('image', $filename, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts javascript assets.
|
||||
*
|
||||
* @param string $filename
|
||||
* @return string
|
||||
*/
|
||||
function js_asset($filename) {
|
||||
return asset('js', $filename);
|
||||
}
|
||||
|
||||
/* End of file asset_helper.php */
|
||||
|
||||
Reference in New Issue
Block a user