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

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 :)