Search code examples
phpcodeignitercodeigniter-2codeigniter-3

Layout.php is not showing the header.php part


I have Html like below.

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <!-- Meta, title, CSS, favicons, etc. -->
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
    </head>
    <body style="background:#F7F7F7;">
        <div class="">
        </div>
    </body>
</html>

I divided this html in two PHP files. So.There is Header.php. Like Below.

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>

Layout.php

<!DOCTYPE html>
<html lang="en">

    <? include 'header.php';?>

    <body style="background:#F7F7F7;">
        <div class="">
        </div>
    </body>
</html>

Problem

Layout.php is not showing the header.php part.


Solution

  • I think the problem is with short tags,

    <?php include 'header.php';?>
    

    But i would say, in codeigniter use,

    $this->load->view("header.php");