Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

Matt Bell
Matt Bell
197 Points

Please help me try work something out :P

Ok so im trying to find out how coding language is generated. Lets use Face Book for example. When a user signs up there profile is made and all that but how does that code automatically generate for a new person if that makes sense ? Im trying to find out what it is that automatically loads the right code say like the CSS and HTML. Im sorry if i make no sense but just trying to get my head around and understand it.

Thanks in advanced to any replies.

2 Answers

None of the unique data (such as profile picture, username, etc) that you see on websites are generated/calculated on HTML nor CSS. These languages are only for the layout and style of the website.

All of the logic behind these things are worked out server-side based on what you logged in with. If you login on website.com/login then that login-page will send you a session-id.

When you tell the browser you want to go, say website.com/profile, then the webserver will take that request, look at the session-id that was stored earlier on your browser and from there it will know who you are. From there it will probably query a database where it will load all relevant data that match your username of your session-id. Once this is done, the server will process the HTML and send it to your browser.

This method is called Sessions, but you can do similar things with cookies. Though sessions are usually the best way to go.

For more about php-sessions, read here http://www.w3schools.com/php/php_sessions.asp

I would say php is the easiest language to learn and start doing stuff like this, but there are many more languages out there!

For a start, learn how to make a basic website using HTML and CSS. Once you feel confident in that you can move on with basic php. Treehouse should have you more than covered on those fronts!

Good luck!

Matt Bell
Matt Bell
197 Points

Thanks so much :)

Ian Nuttall
Ian Nuttall
11,312 Points

Well Facebook is dynamically generated using PHP. So there's a lot of stuff going on in the backend on the server that gets all of the information (friends list, recent updates etc) which then generates the HTML you're seeing.

For now, I wouldn't worry about that and just focus on the static HTML which you can use to build websites. As your knowledge grows you can expand into more advanced ways of doing it.

Matt Bell
Matt Bell
197 Points

Thank you for the reply helps a lot :)