dongmimeng5500 2011-07-15 10:25
浏览 140
已采纳

你如何在网页中调用Header.html / Footer.html?

I've been making a website with about 25 pages and every time I want to update the nav bar, or the footer, I have to go through every page and make the change!

Surely there is a way to have the header and the footer (and the side bar!) in separate documents and call them in the same way a CSS is called so they don't have to be repeated on every page.

Bonus: Is this likely to affect SEO in any way? Might it slow down the site?

Thank you,

Tara

  • 写回答

2条回答 默认 最新

  • dpnfxk251524 2011-07-15 10:33
    关注

    by using include():

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Your page</title>
    
    <style type="text/css">
    <!--Your styles ect that make your page-->
    </style></head>
    
    <body>
    
    <div class="container">
      <div class="header"><?php include('./site_content/header.html');?></div>
      <div class="sidebar"><?php include('./site_content/sidebar.html');?></div>
      <div class="content">
      your content
      </div>
      <div class="footer"><?php include('./site_content/footer.html');?></div>
    </div>
    </body>
    </html>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?