Skip to content

Instantly share code, notes, and snippets.

@prio101
Created June 22, 2015 09:25
Show Gist options
  • Save prio101/71b6f902b4fa1d392b62 to your computer and use it in GitHub Desktop.
Save prio101/71b6f902b4fa1d392b62 to your computer and use it in GitHub Desktop.
Theme Helper For The Codeigniter
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// CSS loader front-end
if( ! function_exists('theme_style_site')){
function theme_style_site($var = ''){
$url = base_url("assets/site/".$var);
return '<link rel="stylesheet" href="'.$url.'" >';
}
}
// CSS Loader for the admin panel path
if( ! function_exists('theme_style_admin')):
function theme_style_admin($var = ''){
$url = base_url("assets/admin/css/".$var);
return '<link rel="stylesheet" href="'.$url.'" >' ;
}
endif;
// Bower CSS path loader Admin Panel
if( ! function_exists('theme_bower_style')){
function theme_bower_style($var = ''){
$url = base_url("assets/admin/bower_components".$var);
return '<link rel="stylesheet" href="'.$url.'" rel="stylesheet">';
}
}
//Bower Script path loader Admin Panel
if( ! function_exists('theme_bower_script')){
function theme_bower_script($var = ''){
$url = base_url("assets/admin/bower_components".$var);
return '<script src="'.$url.'"></script>' ;
}
}
// Script Loader for the admin panel path
if( ! function_exists('theme_script_admin')):
function theme_style_admin($var = ''){
$url = base_url("assets/admin/js/".$var);
return '<script src="'.$url.'"></script>' ;
}
endif;
// script loader for site front-end
if( ! function_exists('theme_script_site')){
function theme_script_site($var = ''){
$url = base_url("assets/site/".$var);
return '<script type="text/javascript" src="'.$url.'"></script>';
}
}
// Image loder
if (!function_exists('theme_image')) {
function theme_image($var = '',$alt='',$class=''){
$url = base_url("assets/site/".$var) ;
print('<img src="'.$url.'" alt="'.$alt.'" class="'.$class.'">') ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment