0
                <?php
                defined('BASEPATH') OR exit('No direct script access allowed');
                //error_reporting(0);
                $this->load->view('layouts/topmenu.php', $metaData);
                //echo $emailid;
                //exit;
                ?>
                //I would like to display an HTML file here
                 <a href=""></a>
                <?php $this->load->view('layouts/bottom'); ?>
                <?php $this->load->view('layouts/footer'); ?>

I want to display a header and footer page with an html file in between them which is in a .html file.

How do I display the .html file in the PHP code ?

4 Answers 4

3

One of the good things of Codeigniter is that this is quite easy to do and has multiple ways to do it

Since it looks like the problem is that the view you need to call is an html file instead of a php file, all you need is to place the html file in your views directory and load it specifiying the filename extension:

$this->load->view('layouts/file.html');

That's all there is to it really

Sign up to request clarification or add additional context in comments.

1 Comment

0

You can utilize the PHP function include which will pull the contents of another file into your PHP script when it runs.

include('file.html');

Comments

0

load same as header footer and use html extention too with file name.

Comments

0

1st, you only send views through your controller. NOT through another view. You should show your controller and what your metadata is

public function Page() {
 $this->load->view('layouts/topmenu.php', $metaData);
 $this->load->view("file.html");
 $this->load->view('layouts/bottom');
 $this->load->view('layouts/footer');
 }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.