I try to load a codeigniter view in iframe as,
`<iframe src="<?php $this->load->view('lists');?/>"></iframe>`
But the page could not load.
With out i frame its working.
How do i load this view in iframe ?
['https://Stackoverflow.com/questions/15501034', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1939388/']
create a function in your controller

```
//project.php

function view_list()
{
$this->load->view('lists');
}

```

and call in the view page like this

```
<iframe src="<?php echo site_url('project/view_list');?>">>    </iframe>

```
I wanted to tile a site with several views, each in their own iframe, this is what I did:

The controller, **book.php**

```
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Book extends CI_Controller {

    public function index(){
        $this->shell();
    }

    public function shell(){

        $data['title'] = "Home";
        $data['frames'] = array(
            "book/events"
            ,"book/sales"
            ,"book/purchases"
            ,"book/cashflows"
        );

        $this->load->view("shell", $data);

    }

    public function events(){
        $this->load->view("events");
    }

    public function sales(){
        $this->load->view("sales");
    }

    public function purchases(){
        $this->load->view("purchases");
    }

    public function cashflows(){
        $this->load->view("cashflows");
    }

}

```

The view **shell.php** contains a foreach statement letting me pass in tiles dynamically. Note how the url's to each site are written in the controller above ^^ (eg. "book/events").

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title><?php echo $title ?></title>     
    </head>
    <body>

        <?php foreach ($frames as $frame):?>
            <iframe src="<?php echo $frame?>"></iframe>
        <?php endforeach;?>

        <div class="footer">
            Page rendered in <strong>{elapsed_time}</strong> seconds</p>
        </div>
    </body>
</html>

```

Then each tile is simply it's own site, like so:

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Events</title>       
    </head>
    <body>
        <div class="header">Events</div>
        <div class="content"> Bla bla bla you have no money</div>
        <div class="footer">
            Page rendered in <strong>{elapsed_time}</strong> seconds</p>
        </div>
    </body>
</html>

```