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 Build a Simple PHP Application Creating the Menu and Footer Including the Header

iv read its bad to wright a page as a php but these tutorials seam to be teaching that is this ok to do this?

iv been learning php before i came here and a lot of what iv raid said that its better to pass information from php to an html file then to wright a page in a php file not shore which is correct

It's considered more secure to hide php extensions so your server side set up can't be figured out easily. In reality, if someone wants to know what you're running they're probably smart enough to figure it out anyway. The problem is handling php extensions as html takes a bit of work. If you run a typical html file as html with php in it, it will probably output some garbage or ignore the php. To get it to run php as an html extension you need to edit the htaccess file. They may have avoided doing it because if you mess things up you've potentially got a problem overall. That's my understanding anyway.

1 Answer

This is a beginners guide to php so it's not overly strict on code design. Normally you would try to separate out your concerns a little more. However, I think there is an upcoming video where Randy refactors the code to fit a more MVC design.