[eluser]wiredesignz[/eluser]
application/helpers/asset_helper.php
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
function asset($type = 'css', $source = NULL, $attrib = NULL, $relativeURL = TRUE)
{
$href = ($relativeURL) ? '' : base_url();
$source = $href . str_replace(".{$type}", '', $source);
switch ($type)
{
case 'css':
{
return '<link rel="stylesheet" type="text/css" href="'.$source.'.'.$type.'" '.$attrib.' />'."\n";
}
case 'js':
{
return ''."\n";
}
case 'img':
{
return '<img src="'.$source.'" '.$attrib.' />'."\n";
}
}
}
Useage in View
Code:
<?php echo asset('css', 'css/stylesheet', 'media="screen"'); //relative URL ?>
<?php echo asset('img', 'images/logo.jpg', 'alt="logo"', FALSE); // full URL ?>
The forum killed the javascript part of the helper? I think you get the idea though.