Jump to content

include command not working


Pitidd
 Share

Recommended Posts

Hi!I recently programmed a Websit and put it on XAMPP, only to see that the PHP include command responisble for the Website does'nt work.Here is the HTML:

<!doctype html><html><head>  <meta charset="UTF-8">  <meta name="viewport" content="width=device-width" />  <title>About me.</title>  <link rel="stylesheet" href="style.css" /></head><body>  <header>    <h1>My Pages.</h1>  </header>  <?php require 'sidebar.php'; ?><div id="main" margin-top="5px">			  <div id="ut">	    <h2>Lorem Ipsum</h2>	    Dolor sit amet.	  </div>	  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas tincidunt sodales tellus et condimentum. Vestibulum ac magna ac enim venenatis porttitor vel a lorem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi placerat massa fermentum justo tempor in rutrum erat tempor. Phasellus tempus rhoncus odio, id mattis ipsum viverra id. Fusce in lectus vel dolor interdum laoreet. In ut mi velit.	  </div>    </div></body></html>

and here is the sidebar.php:

<html><body><div id="sidesec">The Sidebar of Doom!<br>-------------------------<br><ul style="list-style-type: disc; text-align: left;"><li><a href="#">Home</a></li><li><a href="#">About me.</a></li></ul></div><div id="sidesec">Lorem Ipsum<br>dolor sit amet,</div></div>';?></body></html>

I've tried it on multiple browsers now, but it does not show the sidebar. Please tell me what i'm doing wrong, as I have no more Idea what to try.

Link to comment
Share on other sites

In the browser, view the source code. Where the included material should be, do you see: 1. nothing? Your path to the file is probably incorrect. 2. the <?php ?> tags? PHP is not enabled on your server, OR your shell document has an .html extension, and the server is configured only to parse PHP in files with a .php extension. FWIW, the include file does not need <html> and <body> tags, since the shell document already has them.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...