Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Basics PHP on the Web Don't Repeat Yourself

Code not working as in the video.

I have entered the code in for the php but it as all showing up in orange rather than changing color. When i load the web page it just shows blank areas where my name should be. I don't know what i am doing wrong?

jamesjones21
jamesjones21
9,260 Points

Hi Daniel, can you share your code with me ?

if there is orange parts, then you have forgotten to close a statement off with a semi colon.

2 Answers

I seem to have sorted it. The file extension was .html rather than .php. Thanks though

jamesjones21
jamesjones21
9,260 Points

Yeah sorry, I looked at the code and everything seemed fine, but if it was .html then it happens :)

<?php 
$dispay_name = 'Daniel Ayscough';
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset=utf-8>
    <title>PHP Basics by <?php echo $display_name; ?></title>
    <link href="css/style.css" rel="stylesheet" />
  </head>

  <body>
    <div id="wrap">
        <section class="sidebar text-center">
          <div class="avatar">
            <img src="img/logo.png" alt="Alt For Image">
          </div>
          <h1><?php echo $display_name; ?></h1>
          <p>Contact:<br />
          <a href="mailto:">EMAIL</a></p>
          <hr />
          <ul class="social">
            <li><a href=""><span class="icon twitter"></span></a></li>
          </ul>
          <hr />
          <p>Today: D, d M Y</p>
        </section>
        <section class="main">
          <h1>My First PHP Page</h1>

          <h2>Unit Conversion</h2>

          <hr />

          <h2>Daily Exercise</h2>
        </section>
    </div>
    <section class="footer text-center">
      &copy; 2016 <?php echo $display_name; ?>.
    </section>
  </body>
</html>