October 25, 201213 yr Should I write html elements into included php file or not? included file being called in example <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <link rel="shortcut icon" href="favicon.ico" /> <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'> <style TYPE="text/css"> #nav { position:absolute; width: 560px; right:230px; top: 45px; list-style: none; } #nav li { float: left; list-style: none; } #nav li a { display: block; padding: 8px 15px; text-decoration: none; font-weight: normal; font-size: 16px; font-family: 'Droid Sans', sans-serif; color:#442614; border-right: 1px solid #d7d7d7; } #nav li a:hover { color: #000; background-color: #fff; } #telephone { position:absolute; right:10px; padding:5px; } </style> </head> <body> <div id="top_header"> <div id="top-header-sub"> <div id="logo"> <a href="index.php"><img src="img/logo.png" border="0" /></a> </div> <div id="telephone"> <p>Tel: +44(0)208 443 1234</p> </div> <ul id="nav"> <li><a href="aboutus.php">ABOUT US</a></li> <li><a href="projects.php">PROJECTS</a></li> <li><a href="services.php">SERVICES</a></li> <li><a href="team.php">TEAM</a></li> <li><a href="contact.php">CONTACT</a></li> </ul> </div> </div> </body> </html>
October 25, 201213 yr Dont include your example, in previous questions you have asked you have been including files that contain<html> <head> and <body> tags so you have ended up with 2 or more <head><body> Tags put your css into an external css file if you want to create a header and navigation to include then remove the </body> </html> you can then include that file put it in an includes folder and call it header.php you can then include it in each file like this <?php include "includes/header.php"; ?> then you can create a footer.php that can be included that contains </body> </html> and any other information the footer requires The problem you have been having in the past is including files that contain <head></head><body></body><html></html> Hope this helps Edited October 25, 201213 yr by ELITE
October 25, 201213 yr An include should only contain just that, only the code that would normally be there any way, so no <html>, <body> etc...
Create an account or sign in to comment