i recently debugged all the errors on the connection of my headers css and js, there are no errors anymore, but css still isnt working. but the format of my view is changed, but not as i wanted.
login.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends CI_Controller {
public function index(){
$data['main_content'] = 'login_view';
$this->load->view('includes/viewtemplates',$data);
}
viewTemplates.php
<?php $this->load->view('includes/header'); ?>
<?php $this->load->view($main_content); ?>
<?php $this->load->view('includes/footer'); ?>
header.php
<!--DOCTYPE html-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Login</title>
<link rel="stylesheet" href="<?php echo base_url();?>public/css/bootstrap-responsive.min.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="<?php echo base_url();?>public/css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="<?php echo base_url();?>public/js/jquery.js"></script>
<script src="<?php echo base_url();?>public/js/bootstrap.js"></script>
</head>
<body>
<header>
</header>
bootstrap-responsive.min.css
body {
background: #F0F0F0 ;
margin: 0;
padding: 0;
font-family: 'times-new roman';
}
#login_form {
width: 300px;
background: 3333FF;
border: 1px solid white;
margin: 100px auto 0;
padding: 1em;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
h1, h2, h3, h4, h5 {
margin-top = 0;
text-align: center;
color: 000033;
text-shadow: 0 1px 0;
}
there is a problem in website images it will not load correctly
you can use base tag for this(you need to add <base>
tag in <head>
) ...
<base href="<?php echo base_url();?>public/">
and make sure image floder is in public directory
Make sure you have to loaded the URL Helper Class in your controller or in autoload.php
because to use base_url()
(shorthand) you need to load URL Helper
$this->load->helper('url');
Than you can use shorthand base_url()
:
<?php echo base_url();?>
And i didn't see the URL helper loaded in your controller.
Also check HTML view source and hit the URL you will get the better understanding.
You can also check either ending slash / available in base_url()
or not
This will also not work, if your URL looks like this:
<script src="<?php echo base_url();?>public/js/jquery.js"></script>
// example.compublic/js...