Welcome Guest, Not a member yet? Register   Sign In
Asset library
#2

[eluser]CroNiX[/eluser]
Sounds like an easy thing to add. Just pass an array of assets to your template and in the header template, in the head section, check to see if any were set. If so, output them.

Code:
$data['assets']['js'][] = 'http://yoursite.com/js/file1.js';

$this->load->view('your_view', $data);

Code:
<HEAD>
//load global js
<skript type="text/javascript" src="http://yoursite.com/js/my_common_js.js"></skript>

//load custom js
&lt;?php if (isset($assets['js']): ?&gt;
&lt;?php foreach($assets['js'] as $js_file): ?&gt;
<skript type="text/javascript" src="&lt;?php echo $js_file; ?&gt;" ></skript>
&lt;?php endforeach; ?&gt;
&lt;?php endif; ?&gt;

//same thing with CSS
&lt;/HEAD&gt;


Messages In This Thread
Asset library - by El Forum - 09-12-2013, 10:20 PM
Asset library - by El Forum - 09-13-2013, 09:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB