Code Igniter Doc Type

Custynotnug

New Member
I have written an application in Code Igniter. Unless i declare the \[code\]<!DOCTYPE HTML>\[/code\] at the very beginning of index.php (the file in the root directory supplied by Code Igniter), Interenet Explorer forces itself into quirks mode and totally messes up my page. I have tried putting at the very beginning of my views with no luck.This wouldn't normally be a problem, but one of the controllers powers a mobile authentication system that returns a JSON response in the view and the \[code\]<!DOCTYPE HTML>\[/code\] hinders the response.So why is the doc type declaration being ignored when placed at the top of my views? and why does it work when placed at the top of index.php?More importantly, how can I get around this?Thanks for any help!EDIT:This is an example of a controller method that loads the view:\[code\]public function login() { ?><script type="text/javascript">console.log("Admin log in panel loaded");</script><?php //This method will have the credentials validation $this->load->library('form_validation'); $this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean'); $this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|callback_checkDatabase');//Database gets queried with a call-back here. //Set custom validation messages: $this->form_validation->set_message('checkDatabase', 'Invalid credentials'); //This is executed when the form is submitted if($this->form_validation->run() == FALSE) { //Field validation failed. User remains on login page. $this->load->view('header'); $this->load->view('useradminviews/login'); $this->load->view('footer'); } else { //Login successful, redirect to admin dashboard ?><script type="text/javascript">console.log("User logged in successfully");</script><?php redirect('useradmin?login', 'refresh'); } }\[/code\]and this is header.php:\[code\]<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>COFRA</title><link rel="icon" type="image/png" href="http://stackoverflow.com/questions/10546813/<?php echo base_url();?>/images/favicon.png" /><script type="text/javascript" src="http://stackoverflow.com/questions/10546813/<?php echo base_url();?>/javascript/jquery.js"></script><?php//Load different CSS for IE users:if ($this->agent->is_browser('Internet Explorer')){ ?> <link href="http://stackoverflow.com/questions/10546813/<?php echo base_url();?>/javascript/placeholder/css/style.css" rel="stylesheet" type="text/css" media="screen"/> <link href="http://stackoverflow.com/questions/10546813/<?php echo base_url();?>/css/COFRAIE.css" rel="stylesheet" type="text/css" media="screen"/> <script type="text/javascript" src="http://stackoverflow.com/questions/10546813/<?php echo base_url();?>/javascript/placeholder/js/jquery.placeholder.js"></script> <?php} else { ?><link href="http://stackoverflow.com/questions/10546813/<?php echo base_url();?>/css/COFRA.css" rel="stylesheet" type="text/css" media="screen"/><?php}?></head>\[/code\]
 
Back
Top