Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Should I write <html> elements with my php include file or not?

Featured Replies

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>

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 by ELITE

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.