I use a ./application/helpers/asset_helper.php The code is below.
PHP Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* ------------------------------------------------------------------------
* Created by phpDesigner 2016.1.
* Date : 03/23/2016
* Time : 6:15:20 PM
* Author: Raymond L King Sr.
* ------------------------------------------------------------------------
*
* Helper assets_helper
*
* ------------------------------------------------------------------------
*/
/**
* Expects that all resources are in an assets directory in the root folder.
*
* application
* system
* index.php
* assets
* -- css
* -- js
* -- img
* -- images
* -- ico
* -- media
* -- themes
* -- etc
*
* Usage:
*
* <?php echo asset('app.css'); ?>
*
* You can also pass in a directory to the method's
*
* <?php echo asset('directory/app.css'); ?>
*
*/
/**
* Helper asset ()
* ------------------------------------------------------------------------
*
* @access public
* @param string
* @return string
*/
if ( ! function_exists('asset'))
{
function asset($uri)
{
$_ci =& get_instance();
return $_ci->config->base_url('assets/'.$uri);
}
}
/**
* fa_icon ()
* ------------------------------------------------------------------------
*
* Author: [email protected]
* Date: 8/24/15
* Hope this helps you, please at least leave my name in place
*
* Modified by: [email protected]
* Date: 5/3/16
*/
if ( ! function_exists('fa_icon'))
{
/**
* Icon
*
* Generates an Font-Awesome icon tag.
*
* USAGE:
*
* <?php echo fa_icon('ambulance') ?>
* or
* <?php echo fa_icon('ambulance','fa-2x') ?>
*
* @param string icon
* @param string attributes
* @return string
*/
function fa_icon($icon = '', $attributes = '')
{
return '<i class="fa fa-'.$icon.' '.$attributes.'"></i>';
}
}
/**
* ------------------------------------------------------------------------
* Filename: asset_helper.php
* Location: ./application/helpers/asset_helper.php
* ------------------------------------------------------------------------
*/
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )