Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

my helper

Derek Jones edited this page · 5 revisions
Clone this wiki locally

useful php funciton helpers.


<?php
if (! function_exists('load_js')) {
    function load_js($js='') {
        if (empty($js)) {
            return;
        }
        $CI =& get_instance();
        $content = '';
        if (is_array($js)) {
            foreach ($js as $i) {
                $content .= '<script type="text/javascript" src="'.$CI->config->site_url('/scripts/'.$i).'"></script>'."\n";
            }
        } else {
            $content = '<script type="text/javascript" src="'.$CI->config->site_url('/scripts/'.$js).'"></script>'."\n";
        }
        unset($CI);
        return $content;
    }
}

if (! function_exists('load_css')) {
    function load_css($css='', $media='all') {
        if (empty($css)) {
            return;
        }
        $CI =& get_instance();
        $content = '';
        if (is_array($css)) {
            foreach ($css as $i) {
                $content .= '<link type="text/css" rel="stylesheet" href="'.$CI->config->site_url('/styles/'.$i).'" media="'.$media.'" />'."\n";
            }
        } else {
            $content = '<link type="text/css" rel="stylesheet" href="'.$CI->config->site_url('/styles/'.$css).'" media="'.$media.'" />'."\n";
        }
        unset($CI);
        return $content;
    }
}
?>
Something went wrong with that request. Please try again.