1
Speak guys, I’m trying to learn in php race, I’m developing a home site and I would like my Menu to stay fixed on all pages of this my site.
This is the.php menu file that I want to use on all other pages with include:
<html>
<head>
<title>ThreePower</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css" />
<body>
<div id="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="redes/redes.php">Redes</a></li>
<li><a href="#">Fóruns</a>
<ul>
<li><a href="#">Vivao</a></li>
<li><a href="#">Clube</a></li>
<li><a href="#">Stack</a></li>
<li><a href="#">Flash</a></li>
</ul>
</li>
<li><a href="#">Programação</a>
<ul>
<li><a href="#">JAVA</a></li>
<li><a href="#">Jquery</a></li>
<li><a href="#">Javascript</a></li>
<li><a href="#">PHP</a></li>
</ul>
</li>
<li><a href="#">Projetos</a>
<ul>
<li><a href="#"> Scripts </a></li>
</ul>
</li>
</ul>
</div>
</body>
</head>
This is my Style which is mixed with the top html code:
<style type="text/css">
body {
background-repeat: no-repeat;
-webkit-background-size: 100%;
-o-background-size: 100%;
-moz-background-size: 100% 100%;
width: 100% 100px;
height: 800px;
}
#nav {
float: left;
margin: 100px;
margin-top: -2px;
margin-right: 120px;
margin-left: 340px;
}
#nav ul {
font: 16px arial, tahoma, verdana;
list-style: none;
margin: 0;
padding: 0;
}
#nav ul li {
float: left;
position: relative;
display: block;
}
#nav ul li a {
color: #555;
background: #FFF;
text-decoration: none;
margin: 0 1px;
padding: 15px 20px;
border-top: 1px solid #555;
display: block;
}
#nav li ul {
display: none;
}
#nav ul li a:hover {
background: #066;
color: #FFF;
}
#nav li:hover ul {
display: block;
position: relative;
}
#nav li:hover li {
float: none;
font-size: 12px;
}
#nav li:hover a {
background: #333;
opacity: 0.5;
color: #FFF;
}
#nav li:hover li a:hover {
background: #222;
}
#textos{
height: 500px;
}
</style>
Now on my.php network page (for example), which I want to insert I have put only the following command for testing:
<? php include "menu.php"; ?>
However Nothing works, I even thought it was my WAMP settings, I tried and found a php option called Include and it was disabled, so I enabled it and nothing worked, the 2 folders are in the same place inside "WWW". Is the syntax correct for me, any personal observations? Taking advantage of the line... Is it feasible to save all my development pages with php extension? Since it can "read" or better said, differentiate codes from tags like and the very . Thanks in advance, hugs.
<? php
cannot have space– Sam
"It doesn’t work" in what sense?
– Sam
It does not work in the sense of not performing the include function on the networks.php page, the menu is not passed to this page...
– ThinKing
The original code is correct, with <?php include "menu.php"; ?>
– ThinKing
tries to exchange "include" for "require"
– Sam
I made the exchange and yet the same mistake persists.
– ThinKing
Enter the complete file code, networks.php
– MagicHat