Jump to content
Sign in to follow this  
Pitidd

include command not working

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...