[英]How can I display my Navbar Code in multiple HTML documents by linking to one document containing the HTML Code on Desktop and Mobile?
I have a blog type website I am creating and I would like to have the code for my navbar appear on multiple pages on the website, but be linked from one file.我正在创建一个博客类型的网站,我希望我的导航栏的代码出现在网站的多个页面上,但从一个文件链接。 I would like it to be linked in the same way that CSS & Javascript documents are linked to an html document.
我希望它以与 CSS 和 Javascript 文档链接到 html 文档相同的方式链接。
I am a bit new to webcoding so I apologize in advance if I do not explain something properly and I am happy to clarify if anyone has any questions我对网络编码有点陌生,所以如果我没有正确解释某些事情,我会提前道歉,如果有人有任何问题,我很乐意澄清
The website is using HTML, CSS, Javascript and Bootstrap 5 CSS & Scripts.该网站使用 HTML、CSS、Javascript 和 Bootstrap 5 Z2C56C360580420D293Z&72F4。 I'm open for using other coding languages if that is recommended.
如果推荐的话,我愿意使用其他编码语言。
I'm open for using other coding languages if that is recommended.
如果推荐的话,我愿意使用其他编码语言。
Than I would suggest using a server-side language for it.比我建议使用服务器端语言。 PHP could be very easy:
PHP 可能非常简单:
Your main file (index.php) should be something like this:你的主文件(index.php)应该是这样的:
<html>
<head>
<!-- Title & meta tags, etc... -->
</head>
<body>
<?=include("header.php"?>
<!-- Unique page content goes here -->
</body>
</html>
and inside the file header.php just throw your navbar.并在文件 header.php 中扔你的导航栏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.