Created
August 29, 2011 00:01
-
-
Save ruthlessfish/1177426 to your computer and use it in GitHub Desktop.
serve assets with correct content type header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('BASEPATH') OR exit('No direct script access allowed'); | |
if( ! function_exists('show_css')) | |
{ | |
function show_css($content) | |
{ | |
show_output('text/css', $content); | |
} | |
} | |
// -------------------------------------------------------------------- | |
if( ! function_exists('show_js')) | |
{ | |
function show_js($content) | |
{ | |
show_output('text/javascript', $content); | |
} | |
} | |
// -------------------------------------------------------------------- | |
if( ! function_exists('show_json')) | |
{ | |
function show_json($data) | |
{ | |
show_output('application/json', json_encode($data)); | |
} | |
} | |
// -------------------------------------------------------------------- | |
if( ! function_exists('show_output')) | |
{ | |
function show_output($content_type, $content) | |
{ | |
get_instance()->output->set_content_type($content_type) | |
->set_output($content); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment