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!

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 Enhancing a Simple PHP Application Cleaning URLs with Rewrite Rules Rewrite Rules with Query Strings

Regarding the Project Files for the PHP Courses...

I'm really enjoying this course so far, but I noticed something about the files...

I left this course for a little while to go do the Using PHP with MySQL course, since the need to know about databases is more of an immediate need at the moment.

I had quite a time with some of the files, though. It may be in part because I kept them in a sub-folder (localhost/treehouse/PDO_tutorial/ for the PHP with MySQL, and localhost/treehouse/shirts4mike_project/ for this one), and so had to update the ROOT_PATH and BASE_URL definitions to reflect that, along with the RewriteRules, but I noticed that a lot of the problems I was having were solved when I came back to this course. There were some instances of the "require_once" thing not being there in the files for the PHP with MySQL course, and some of the places where we add in "BASE_URL" in this course also seem to be missing from the MySQL course.

I might be mistaken, but I thought I would make note of it just the same. :)


1 Answer

I took the courses in order, but downloaded fresh files for the MySQL course. I don't remember having any problems.

I see what's going on now; the downloadable files accompanying the videos contain the code that is entered during each video. That's what threw me off... (I've noticed this with some of the CSS courses as well)

I actually wouldn't think that would be a very good idea for beginners still working to grasp the concepts behind the work. I prefer to follow along step by step, so I would think it a much better idea to have the "beginning-of-section" code in the downloads, as opposed to the "end-of-section" version (and I think that's what I was expecting too, which is why I got thrown off).

Sometimes several tiny changes are made during the video, and if you have the "finished" version of the code, you're following along, and you see something different in the video, change it in the code, and because there is another bit of code elsewhere in the lot that was changed later in the video, it messes things up even more and just adds to the confusion. Other times, changes are made to one big chunk of code, like when Randy moves the code from index.php to the "model" to refactor it. Looking at the finished version of the code while trying to follow along really throws me for a loop. It's like I have to wait and see what Randy does and then try to make sense of it, as opposed to actually being "in step" with what's going on.

What's more, I've noticed that, at least for me, if I'm provided with "this is how the code will look at the end of this video", then I just kind of stare at the code and watch the video. If provided with the "this is the code as it sits right now" versions of the file, though, I can follow along with Randy Hoyt or Guil Hernandez, step-by-step, actually "digging into" the code, mentally engaged with the work. It's really the difference between being "under the hood" and being "behind the glass".

I know some of the downloads give you a choice of opening the beginning or end code. I think my normal practice was to download the opening code and just build from that. If I ran into a problem I couldn't figure out I download the completed code and compare the two to find the error.

Yeah, I can see in some of the downloads for Framework Basics that there are "Start" and "Finish" versions of the code, but from what I can tell, there are only the finished versions for the PHP courses.

At least I understand what is going on now :)