- CodeIgniter Web Application Blueprints
- Rob Foster
- 168字
- 2021-08-06 19:34:28
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:
- 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 closinghead
tags, and the openingbody
tag. - 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.
推薦閱讀
- Modular Programming with Python
- Go語言高效編程:原理、可觀測性與優化
- 零基礎學Java(第4版)
- 名師講壇:Java微服務架構實戰(SpringBoot+SpringCloud+Docker+RabbitMQ)
- 深入淺出RxJS
- Java項目實戰精編
- WebRTC技術詳解:從0到1構建多人視頻會議系統
- Building Android UIs with Custom Views
- Test-Driven Machine Learning
- Service Mesh實戰:基于Linkerd和Kubernetes的微服務實踐
- 快速入門與進階:Creo 4·0全實例精講
- ScratchJr趣味編程動手玩:讓孩子用編程講故事
- Mastering HTML5 Forms
- HikariCP數據庫連接池實戰
- 少年小魚的魔法之旅:神奇的Python