how to call a section of one view page in to another view page?

江枫思渺然 提交于 2019-12-13 05:27:58

问题


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>     

来源:https://stackoverflow.com/questions/51088024/how-to-call-a-section-of-one-view-page-in-to-another-view-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!