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

melissa brown
melissa brown
4,670 Points

blank screen

whenever i view my code in the browser through sublime i just get a blank screen. i have had a look through my function.php but i cant find any errors. also i downloaded the project files final site and put them into workspaces but i just get http://port-80-vf0vdrg9pp.treehouse-app.com/ could it be a bigger problem if i cant even view the project files in the browser? i think its something to do with the php because if i view html coding the browser it works fine

<?php

function wpt_theme_styles() {

    wp_enqueue_style( 'foundation_css', get_template_directory_uri() . '/css/foundation.css' );

    wp_enqueue_style( 'normalize_css', get_template_directory_uri() . '/css/normalize.' );

    wp_enqueue_style( 'googlefont_css', 'http://fonts.googleapis.com/css?family=Asap:400,700,400italic,700italic' );

    wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );

}
    add_action( 'wp_enqueue_scripts', 'wpt_theme_styles');

    function wpt_theme_js() {

        wp_enqueue_script( 'modernizr_js', get_template_directory_uri() . '/js/modernizr.js','','', false);
        wp_enqueue_script( 'foundation_js', get_template_directory_uri() . '/js/foundation.js' ,array('jquery'),'', true);
        wp_enqueue_script( 'main_js', get_template_directory_uri() . '/js/app.js' ,array('jquery'),'',true );

    }

    add_action( 'wp_enqueue_scripts', 'wpt_theme_js');
?>

4 Answers

Nate Conley
Nate Conley
16,191 Points

Go and checkout the tutorial in "Build a Simple PHP Application" on "Installing PHP". You need to set up a local host on your computer, since PHP is server-side, and can't be viewed like plain html in the browser.

Tanner Legassee
PLUS
Tanner Legassee
Courses Plus Student 8,926 Points

If your apache2 (or equivalent) isn't configured with a php5 module, you won't be able to view your php files. I would check over which modules you have active, because your code is not the problem here.

melissa brown
melissa brown
4,670 Points

hi guys i got the server up an running and did the mikes tshirt test site and it works fine. But when i try to load my wordpress site it doesnt work. i just get this error msg

"Fatal error: Call to undefined function get_header() in C:\xampp\htdocs\treehouse-portfolio\index.php on line 1"

the thing is i get this msg whether i am loading the final project files treehouse-portfolio (which is not my code) or if i load my own code.