Welcome Guest, Not a member yet? Register   Sign In
NEED HELP!
#1

[eluser]kre8ivdesigns[/eluser]
I am trying to figure out why codeigniter produces this

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;

This is from view source in Firefox and IE.
#2

[eluser]kre8ivdesigns[/eluser]
I get two pages
#3

[eluser]richthegeek[/eluser]
Unable to help without more information!

Attach the relevant controller and view(s) that produce this, as well as any models that are in use in that controller.
#4

[eluser]Jelmer[/eluser]
It's impossible to tell without any code and more information.

You might try switching on logging in the application/config/config.php. Look through it to see if there's any double loading of resources.

But if I had to guess you probably have an if-else structure somewhere that ends in a $this->load->view() but doesn't return after that and still loads the default condition which loads a view as well.
Something like this:
Code:
$page = $this->page_model->get();
if ($page === FALSE)
{
    $this->load->view('page_not_found');
}

$data['pageinfo'] = $page;
$this->load->view('page', $data);
That would load both the page_not_found and the page views. To make something like this work, add "return" after the view in the if condition, like this:
Code:
if ($page === FALSE)
{
    $this->load->view('page_not_found');
    return;
}
#5

[eluser]kre8ivdesigns[/eluser]
Code:
&lt;?php

class Home extends Controller {

    function Home()
    {
        parent::Controller();    
        
        $this->load->helper('form');
        $this->load->helper('url');
    }
    
    function index()
    {
        $data['title'] = "Casa Milagro Jaco Beach Home - Paradise from Home";
        $data['main'] = "main";
        $this->load->vars($data);
        $this->load->view('template');  
    }

You can check the website at http://www.casamilagrojaco.com
#6

[eluser]kre8ivdesigns[/eluser]
Thanks will look through the code for if else statement.. Also if any of you ever need help with graphics for a site let me know I tend to help those that have helped me.
#7

[eluser]Jelmer[/eluser]
Nothing wrong there, you're sure it's not in your view? Is there anything happing there that might cause this?
#8

[eluser]kre8ivdesigns[/eluser]
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="content-type" content="text/html;charset=UTF-8" /&gt;    
&lt;meta name="keywords" content=""&gt;&lt;/meta>
&lt;meta name="description" content=""&gt;&lt;/meta>
&lt;meta http-equiv="imagetoolbar" content="no" /&gt;
&lt;title&gt;&lt;?php $title; ?&gt;&lt;/title&gt;
&lt;link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /&gt;
&lt;link rel="stylesheet" href="&lt;?php echo base_url(); ?&gt;css/layout.css" media="screen" /&gt;
&lt;link rel="stylesheet" href="&lt;?php echo base_url(); ?&gt;css/easy.css" media="screen" /&gt;
&lt;link rel="stylesheet" href="&lt;?php echo base_url(); ?&gt;css/faary.css" media="screen" /&gt;
&lt;link rel="stylesheet" href="&lt;?php echo base_url(); ?&gt;css/easyprint.css" media="print" /&gt;
&lt;link rel="stylesheet" href="&lt;?php echo base_url(); ?&gt;css/lightbox.css"  media="screen" /&gt;
[removed][removed]
[removed][removed]
[removed][removed]
[removed]
//&lt;![CDATA[
    base_url = '&lt;?php echo base_url(); ?&gt;';
//]]>
[removed]
[removed]
    function isEmailValid(email){
        var e = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
        return e.test(email);
    }
    function sendForm(){
        
        
        jQuery("#imessageOK, #imessageERROR").hide();
        jQuery(".required").removeClass("required");
        if(jQuery("#YourName").val()==""){jQuery("#YourName").addClass("required");window.scroll(0,0);return false;}if(jQuery("#YourEmail").val()==""){jQuery("#YourEmail").addClass("required");window.scroll(0,0);return false;}if(!isEmailValid(jQuery("#YourEmail").val())){jQuery("#YourEmail").addClass("required");window.scroll(0,0);return false;}if(jQuery("#YourMessage").val()==""){jQuery("#YourMessage").addClass("required");window.scroll(0,0);return false;}jQuery("#SendaMessage").val("Please Wait...");        var AddDetails; AddDetails+="&YourName;="+encodeURIComponent(jQuery("#YourName").val());AddDetails+="&YourEmail;="+encodeURIComponent(jQuery("#YourEmail").val());AddDetails+="&YourPhone;="+encodeURIComponent(jQuery("#YourPhone").val());AddDetails+="&YourMessage;="+encodeURIComponent(jQuery("#YourMessage").val());        
                jQuery.ajax({
            type: "POST",
            url: "contact.php",
            data: AddDetails,
            success: function(data){
                
                if(data=='OK'){
                    jQuery(".iform ul").slideUp(function(){
                                                        
                        jQuery("#imessageOK").fadeIn();
                        
                                                        
                    });
                } else {
                    
                    jQuery("#imessageERROR").slideDown();
                    jQuery("#SendaMessage").val("Send a Message!");                    
                }
            }
        });
            }
[removed]
&lt;/head&gt;
&lt;body&gt;
<div id="wrapper">
        <div id="header">&lt;?php $this->load->view('header'); ?&gt;</div>&lt;!-- Header --&gt;
        <div id="navigation">&lt;?php $this->load->view('navigation'); ?&gt;</div>&lt;!-- Navigation --&gt;
        <div id="search">&lt;?php $this->load->view('search'); ?&gt;</div>&lt;!-- Search --&gt;
        <div id="main">&lt;?php $this->load->view($main); ?&gt;</div>&lt;!-- Main --&gt;
        <div id="mainflower"></div>  
</div>&lt;!-- Wrapper --&gt;
<div id="footer">&lt;?php $this->load->view('footer'); ?&gt;</div>&lt;!-- Footer --&gt;
&lt;/body&gt;
&lt;/html&gt;
#9

[eluser]kre8ivdesigns[/eluser]
Yeah this is my first CI website so learning. Been through the tuts and the WROX "Codeigniter" book.
#10

[eluser]Jelmer[/eluser]
Something gets added to you output before the view is loaded it seems. I can't tell from this code where that might happen. If you're working with an unchanged CI download it shouldn't happen in your Controller. There's nothing loaded before the view that might include output that html before your view.
Though there would be stuff loaded if you're autoloading anything. Take a look into any autoloaded library, config, etc. and your main index.php if there's html outside the &lt;?php ?&gt; tags. Or if there's anything echo'ed or printed that would always happen.




Theme © iAndrew 2016 - Forum software by © MyBB