[eluser]John_Betong[/eluser]
[quote author="Colin Williams" date="1255144895"]1.) Don't put your stylesheets in the views folder (you application files should be outside the root anyway)
2.) Use absolute paths like "/style.css" leaving the domain out of it
3.) Get over the "pain" of typing out 30+ char strings
[/quote]
Hi Colin,
I failed to understand why the CSS file should not be in the views folder.
With each new application I have adopted the programming style of having a common MY_Controller.php but renamed to MY_
APPPATH.php to avoid confusion. One of the functions in my common controller is:
./libaries/MY_[b]APPPATH.php[/b]
Code:
function load_partials( $data=array() )
{
$data['doctype'] = doctype();
$data['header'] = $this->load->view('_header', $data, TRUE);
...
...
return $data;
}
./views/_header.php // prefixed with an underscore to denote a partial view
Code:
<link
type='text/css'
href='<?php echo APPPATH ?>views/style_04.css'
rel='stylesheet'
media='all'
/>
./views/v_mainview.php // prefixed with v_ to denote a view page
Code:
<?php echo $doctype ?>
<head>
<?php echo $header ?>
<style type='text/css'>
div {border:dotted 0px #f00}
</style>
<head>
<body
...
...
...
</body
</html>
edit: added view