Welcome Guest, Not a member yet? Register   Sign In
What is the best way to implement the Asset Helper?
#1

[eluser]timpiele[/eluser]
In the past I have always used the Asset Helper to populate variables from within each of my controllers like this:

Code:
$data['css_bootstrap'] = css_asset('bootstrap.css');
$data['js_bootstrap'] = js_asset('bootstrap.js');

and each of my controllers loads the header before the main view like this:

Code:
$this->load->view('header', $data);
$this->load->view('home');
and then just echo'd out those variables in my header like this:

Code:
<?=$css_bootstrap;?>
<?=$js_bootstrap;?>

but this requires me to repeat my code in every controller... (as well as include my header from each controller)

What is the most efficient way to just include these assets once so they are available in my header by default? I'd prefer not to place the calls to the asset helper in my header as I'm trying to keep it as PHP free as possible...


Messages In This Thread
What is the best way to implement the Asset Helper? - by El Forum - 06-02-2013, 02:14 PM
What is the best way to implement the Asset Helper? - by El Forum - 06-02-2013, 02:50 PM
What is the best way to implement the Asset Helper? - by El Forum - 06-02-2013, 03:33 PM
What is the best way to implement the Asset Helper? - by El Forum - 06-03-2013, 01:29 AM
What is the best way to implement the Asset Helper? - by El Forum - 06-03-2013, 09:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB