php - 需要帮助在 codeigniter 中配置 CSS 模板

标签 php css codeigniter


我无法在 codeigniter 中仅配置 css 模板。例如:我是 codeigniter 的初学者。任何人都可以告诉我如何配置它或任何教程。 希望你能理解我糟糕的英语..

这是我的代码

在查看页面home.php

<?php $this->load->view('header_final');?>



     <div id="page">
        <div id="page-bgtop">
            <div id="page-bgbtm">
                <div id="content">
                    <div class="post">
                        <h2 class="title"><a href="#">Home</a></h2><br>

                        <div class="entry">
                            <p><img src="<?=site_url();?>images/img08.jpg" width="538" height="200" alt="" /></p>
                            <p>Sylhet Engineering College (SEC), established in the year 2007 under the School of Applied Science and Technology, Shahjalal University of Science and Technology is best of its kind with a motto to produce the best in class engineers for the 21st century in Bangladesh. There are five universities of Engineering and Technology and some private universities in the country for providing engineering education at B.Sc level which is not sufficient to meet the requirement of today's fast paced engineering sector of Bangladesh. As a divisional city of Bangladesh, Sylhet had no engineering institute. So the Government of Peoples Republic of Bangladesh has established Sylhet Engineering College with a vision to expand the engineering education of Bangladesh as an engineering faculty section of Shahjalal University of Science and Technology.</p>

                        </div>
                    </div>



                    <div class="post">


                    </div>
                    <div style="clear: both;">&nbsp;</div>
                </div>
                <!-- end #content -->


<?php $this->load->view('footer_final');?>


在 Controller 页面 home.php

<?php

class Home extends Controller {

    function Home()
    {
        parent::Controller();   

    }

    function index()
    {

        $this->load->view('home');


    }
}

提示:

header_final.phpfooter-final.php

最佳答案

CodeIgniter 允许您同时加载多个 View 。您想将 View 加载留在 Controller 中。所以你想要做的是在 Controller 中加载页眉 View ,然后加载你想要呈现的实际 View ,然后加载页脚 View 。完成后它看起来像这样:

function index(){
    $this->load->view('header_final');
    $this->load->view('home');
    $this->load->view('footer_final');
}

然后从您的 home.php View 中删除所有 View 加载。

关于php - 需要帮助在 codeigniter 中配置 CSS 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5794670/

相关文章:

jQuery FlyOut 菜单

php - SMTP 错误(220-我们未授权使用此系统传输未经请求的 220 和/或批量电子邮件。)

javascript - PHP 数组用 JavaScript 确定?

php - 在 Yii2 中使用 plpgsql 绑定(bind)查询值

php - 重定向到登录页面,除非用户已登录

jquery - 边框可单击且事件已触发,但未遵循链接

php - CURLOPT_POST 与 CURLOPT_CUSTOMREQUEST

javascript - 没有白色背景的淡入/淡出背景图像

codeigniter - 为了使用 Session 类,您需要在配置文件中设置加密 key

javascript - 下拉子菜单不显示任何数据?