如何在网页中调用Header.html / Footer.html? [英] How do You Call Header.html/Footer.html in a Web Page?
问题描述
我一直在制作一个大约25页的网站,每次我想更新导航栏或页脚时,我都必须浏览每一页并进行更改!
当然,有一种方法可以将页眉和页脚(和侧栏!)放在单独的文档中,并以与调用CSS相同的方式调用它们,因此不必每次重复页面。
奖励:这可能会以任何方式影响SEO吗?可能会让网站变慢?
谢谢,
Tara
<通过使用include():
<!DOCTYPE
解决方案
html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
< html xmlns =http://www.w3.org/1999/xhtml>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
< title>您的网页< / title>
< style type =text / css>
<! - 您的风格让您的页面更加流畅 - >
< / 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>
您的内容
< / div>
< div class =footer><?php include('./ site_content / footer.html');?>< / div>
< / div>
< / body>
< / 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
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>
这篇关于如何在网页中调用Header.html / Footer.html?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!