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 (Retired) PHP Datatypes Associative Arrays

launch workspace

This question is about viewing the code in the browser. For some reason when i want to view the code a blank page just appears. Does anyone know how to fix this problem? Thanks

Bryan Speece
Bryan Speece
15,902 Points

Can you clarify? Is it just the PHP code that doesn't appear or nothing at all? Also, are you talking about code in a workspace or when you select "View Source" in your browser?

I think when she said viewing the code in the browser meaning view source , inspect element like you do HTML and CSS.

Because its in PHP, i believe Jiten is looking for PHP code maybe? but yes , a bit more information would be needed to clarify this .

3 Answers

PHP code doesn't appear in the browser.

Only HTML and CSS appear . And JS I don't remember.

You're missing a ';' somewhere

Sean Keegan - You should have said "Are you missing the semi-colon to terminate your statements", NOT what you said.

I am experiencing exactly the same problem when using workspaces and am working around it by downloading the workspace and opening it within a PHP environment such as XXAMP or MAMP.

https://www.apachefriends.org/index.html

https://www.mamp.info/en/

For example if I use the following code in workspaces, it shows a blank page when i preview the page.

 <?php
    $name = "Dave";
    echo $name;
?>

When I try to view the page in the browser I also get a blank page.

If I inspect the element using the browser tools I see the following:

?php
    $name = "Dave";
    echo $name;
<!--        ?                        -->

It appears that workspaces is removing the angle bracket starting the PHP code block and then inserting a comment at the end.

jiten pomal - Right click on the window and us Inspect Element to see if you are experiencing the same problem.

I am using Firefox 39.0 on an iMac.