[eluser]Friedebarth[/eluser]
So, in order to circumvent the trouble with loading CSS via HTML, which, apart from constantly refusing to work also makes it much harder for users to customise the skin, I downloaded the Assets helper.
The question is, once I load the assets in my controller, like so:
Code:
public function index()
{
// Load the view
$this->load->view('welcome_message');
// Load the assets helper
$this->load->helper('asset');
// Load the css file from the main asset css folder
css_asset('style.css');
}
How do I incorporate it into my view? My view currently looks like this:
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
</head>
<body>
<div id="container">
<h1>Welcome to CodeIgniter!</h1>
<div id="body">
<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
<p>If you would like to edit this page you'll find it located at:</p>
<code>application/views/welcome_message.php</code>
<p>The corresponding controller for this page is found at:</p>
<code>application/controllers/welcome.php</code>
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
</div>
</body>
</html>
I tried doing this in the head:
Code:
<link rel="stylesheet" type="text/css" href="<?php $this->load->helper('asset'); echo text_output($stylesheet);?>" />
While doing that in the controller:
Code:
$data['stylesheet'] = css_asset('style.css');
But that just ended up blanking the whole page. So how do I do it properly?