当前位置:网站首页>如何实现页面包含
如何实现页面包含
2022-07-25 15:29:00 【Gorgio_Liu】
项目中,习惯把多个页面中完全一样的内容,单独提取出来作为一个独立的文件(如header.html、footer.html),凡是需要此文件的页面,引入该页面即可。页面包含可以采用多种方案:
1、利用Web服务器的SSI命令:客户端请求一个页面,服务器一次返回多个页面 — 需要修改Web服务器配置文件。
2、使用服务器端动态语言提供的页面包含函数:如PHP
include(‘header.php’);
...echo’主体’;
include(‘footer.php’);客户端请求一个页面,服务器返回多个PHP页面组合后的一个页面、
3、在客户端使用AJAX技术:先加载一个页面的主体内容,加载完成后。再去请求header.html、footer.html放到空容器中
<div id=”header”></div>
<main>xxxxxxxx</main>
<div id=”footer”></div>
$.ready(function(){
$(‘#header’).load(‘header.html’);
$(‘#footer’).load(‘footer.html’);
})提示:AngularJS中ng模块提供了一个指令:ngInclude,已经实现了方法3
<div ng-include=” ’tpl/header.html’ “></div>
边栏推荐
猜你喜欢

Cf888g clever dictionary tree + violent divide and conquer (XOR minimum spanning tree)

Get the ask code corresponding to the key pressed by the keyboard

Pytorch学习笔记--Pytorch常用函数总结1

How to solve the login problem after the 30 day experience period of visual stuido2019

p4552-差分

Pytorch学习笔记--SEResNet50搭建

4PAM在高斯信道与瑞利信道下的基带仿真系统实验

Pytorch学习笔记-刘二老师RNN高级篇-代码注释及结果

matlab 优化工具 manopt 安装

PAT甲级1152 Google Recruitment (20 分)
随机推荐
2019 Shaanxi Provincial race K-variant Dijstra
LeetCode - 622 设计循环队列 (设计)
JVM-参数配置详解
Cf566a greed + dictionary tree
Pytorch学习笔记-Advanced_CNN(Using Inception_Module)实现Mnist数据集分类-(注释及结果)
组件化和模块化
JVM garbage collector details
2019浙江省赛C-错排问题,贪心
pageHelper不生效,sql没有自动加上limit
Brain racking CPU context switching
Find out what happened in the process of new
CF888G-巧妙字典树+暴力分治(异或最小生成树)
Get the ask code corresponding to the key pressed by the keyboard
PageHelper does not take effect, and SQL does not automatically add limit
CF566A-贪心+字典树
带你创建你的第一个C#程序(建议收藏)
分布式 | 实战:将业务从 MyCAT 平滑迁移到 dble
Ml speech depth neural network model
2016CCPC网络选拔赛C-换根dp好题
带你详细认识JS基础语法(建议收藏)