how to call a section of one view page in to anoth

2019-08-17 02:17发布

问题:

how can i display only "Welcome to my 3rd Blog!" of "blogvieww.php" in "blogview.php" using codegniter. But the below code what i tried with is that, even "Welcome to my 2nd Blog!" of "blogvieww.php" is getting displayed in "blogview.php". actually i just want to display only "Welcome to my 3rd Blog!", how to do this can any one tel me please im not getting where im going wrong.

Blogcontroller.php(controller file)

    <?php  
        defined('BASEPATH') OR exit('No direct script access allowed');  

        class Blogcontroller extends CI_Controller {  

            public function index()  
            {  
                $data['blogvieww'] = $this->load->view('blogvieww', '', TRUE);
                $this->load->view('blogview', $data);  
            }  

            public function blogvieww()  
            {  
                $this->load->view('blogvieww');  
            } 
        }  
    ?>

blogview.php (view file)

    <html>
    <head>
            <title>My Blog</title>
    </head>
    <body>
        <div>
            <div><?php echo $blogvieww; ?></div>
            <h1>Welcome to my 1st Blog!</h1>
        </div>    
    </body>
    </html>

blogvieww.php (view file)

    <html>
    <head>
            <title>My Blog</title>
    </head>
    <body>
        <div>
            <h1>Welcome to my 2nd Blog!</h1>
        </div>

        <div>
            <h1>Welcome to my 3rd Blog!</h1>
        </div>
    </body>
    </html>