官术网_书友最值得收藏!

Creating a shared header and footer view

Every project throughout this book will use the common header and footer files that we will create here; navigation menus will be different for each project and, as such, we will build these in the project's chapter themselves. But for now, let's look at the common header and footer files:

  1. Create the header.php file at /path/to/codeigniter/application/views/common/ and add the following code to it:
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="shortcut icon" href="<?php echo base_url('bootstrap/ico/favicon.ico'); ?>">
    
        <title><?php echo $this->lang->line('system_system_name'); ?></title>
    
        <!-- Bootstrap core CSS -->
        <link href="<?php echo base_url('bootstrap/css/bootstrap.min.css'); ?>" rel="stylesheet">
        <!-- Bootstrap theme -->
        <link href="<?php echo base_url('bootstrap/css/bootstrap-theme.min.css'); ?>" rel="stylesheet">
    
        <!-- Custom styles for this template -->
        <link href="<?php echo base_url('bootstrap/css/theme.css');?>" rel="stylesheet">
    
        <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
      </head>
    
      <body role="document">
    
    <!-- END header.php -->
    
        <div class="container theme-showcase" role="main">

    The preceding view file contains the HTML for the head of a document. This is to say that this HTML is used throughout the book for every project, and it contains the HTML markup for everything from the opening html tag, opening and closing head tags, and the opening body tag.

  2. Create the footer.php file at /path/to/codeigniter/application/views/common/ and add the following code to it:
        </div> <!-- /container -->
        <link href="<?php echo base_url('bootstrap/css/bootstrap.min.css'); ?>" rel="stylesheet">
    
            <!-- Bootstrap core JavaScript
        ================================================== -->
        <!-- Placed at the end of the document so the pages load faster -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
        <script src="<?php echo base_url('bootstrap/js/bootstrap.min.js');?>"></script>
        <script src="<?php echo base_url('bootstrap/js/docs.min.js');?>"></script>
      </body>
    </html>

    The preceding block of code contains the HTML markup for the footer view file used for every project throughout this book.

主站蜘蛛池模板: 溧水县| 雅江县| 玉门市| 永仁县| 延吉市| 防城港市| 西青区| 林西县| 厦门市| 永善县| 陇西县| 潞城市| 滦平县| 应城市| 仁寿县| 应用必备| 五大连池市| 交城县| 建宁县| 阳谷县| 鹤峰县| 平邑县| 云和县| 靖宇县| 泗阳县| 朔州市| 合阳县| 铜川市| 蕉岭县| 仁化县| 新蔡县| 临猗县| 泸定县| 合江县| 林口县| 霍城县| 内黄县| 永年县| 黄冈市| 迁西县| 平和县|