每个页面上的菜单相同 [英] Same menu on every page

查看:65
本文介绍了每个页面上的菜单相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,每个页面上都有菜单。但是,当我尝试在菜单上添加新链接时,我
必须分别在每个页面上添加链接。因此,我使用了这样的HTML和CSS,所以我只需要编辑一件事,但是它只会显示为带有 a标签的主页,而不是将主页显示为超链接。

I have a website that has menu on every page. But, When I try to add new link on the menu, I had to add the link on every page individually. So, I used HTML and CSS like this so I just have to edit one thing, but it will just show up as "Home" with "a" tag on it instead of showing "Home" as hyperlink.

<!DOCTYPE html>
<html>
  <head>
  <style>
    .menu:after{
    content: "<a href="/index.html">Home</a><a href="/game">Games</a>";}
  </style>
  <title>Page</title>
  </head>
<body bgcolor="#cccccc">
  <center>
    <div class="menu"></div>
  <center>
</body>
</html>


推荐答案

创建页面调用

menu.php并放置菜单,例如输入您的代码

menu.php and put the menu, for example with your code

<a href="/index.html">Home</a><a href="/game">Games</a>;

然后在您的index.php中

then in your index.php

<?php 
include('menu.php');
?>

这篇关于每个页面上的菜单相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆