Homework 3 (Movie Review Part Deux) FAQ
-
Q: I had a few bugs or problems in my Homework 2. Should I fix those for HW3?
-
A: We aren't going to devote many points to styling and appearance on HW3. If you had a minor mistake in HW2, you shouldn't focus a lot of time on fixing it for HW3. Instead focus on the dynamic aspects of the page and the PHP code. If you want to fix any HW2 mistakes, that is fine; but don't spend a large amount of your time on it.
-
Q: Do I have to worry that the film might not exist, or its files might be missing or unreadable or invalid or in the wrong format?
-
A: No.
-
Q: I'm trying to use the
glob
function to find a set of files, but it doesn't work; it returns an empty array every time.
-
A: You might be trying to glob a URL; it needs a local path name. You might also have a leading
/
in your path, which you shouldn't. Check that the exact folder/file in your glob matches the folders/files on your web space.
-
Q: How do I validate the page? When I pasted in my .php file's source code, the validator gave a ton of weird errors.
-
A: Don't validate the PHP source code. Upload your PHP code to webster, then view the page in your browser, then click View Source. Now copy/paste that HTML output into the W3C XHTML validator and validate that.
-
Q: Why do I have weird extra spaces after characters that I print from the input files? For example, it prints things like
"33 %"
or " ( 2007 ) "
.
-
A: The file input string you're printing probably has some unwanted whitespace around it. You can see this if you View Source on the HTML output. Look for a PHP function to remove unwanted whitespace from the start/end of strings.
-
Q: Why do I get an error when I use a variable, such as
{$y} = {$x} + 3;
?
-
A: You shouldn't surround a variable with
{}
except when it's used inside of a string (inside the quotation marks, such as print "My location is $x right now.";
). The previous code should be $y = $x + 3;
-
Q: What does this error mean?
Parse Error: syntax error, unexpected $end in ... myfile.php on line #
-
A: You are missing a } or ) closing brace character. TextPad and other editors can do brace matching. In TextPad, select the brace and press Ctrl-M to see its match.