简体   繁体   English

固定的网站侧边栏导航

[英]Fixed Sidebar for Navigation in Website

I want to have a sidebar in my website with navigation in it. 我想在我的网站中有一个带有导航的侧边栏。 I will use script like phpBB etc. but I want sidebar to be displayed on every page. 我将使用phpBB等脚本,但我希望边栏显示在每个页面上。

So I am thinking about making a Sidebar in HTML and then using frame tag for displaying other pages/scripts. 因此,我正在考虑使用HTML制作侧边栏,然后使用frame标签显示其他页面/脚本。

But as Frames are getting obsolute, Is there any other method to display a sidebar in everypage without using frames and without adding html coding on every page? 但是,随着框架变得越来越绝对,是否有其他方法可以在每个页面中显示边栏而不使用框架,并且无需在每个页面上添加html编码?

Put your HTML in a PHP file (or HTML if you want) with no or other tags aside from what you want to display, then put the following on each page you want to display the menu on: 将您的HTML放到一个PHP文件(如果需要,则放进HTML)中,除了要显示的内容外不带任何其他标签,然后在要显示菜单的每个页面上放置以下内容:

<?php include ('page-name.php'); ?>

One line of code is all you need. 您只需要一行代码。 If you make a change to the 'page-name.php' file, it updates on every page. 如果您对“ page-name.php”文件进行了更改,它将在每个页面上更新。

Cheers 干杯

This question was asked here and on Webmasters ; 网站管理员网站管理员上问了这个问题; I answered it over there. 我在那边回答了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM