This Forum has been archived there is no more new posts or threads ... use this link to report any abusive content
==> Report abusive content in this page <==
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is facebook based on php? How to learn building a website like that?
04-28-2014, 12:57 AM
Post: #4
 
I can guarantee one thing: the author of Facebook did NOT have a final product from straight PHP in one week! Perhaps there was a simple working prototype, but there was not a finished site of that complexity!

A word of advice: if the first site you try to code in PHP is Facebook, then the total number of PHP sites you will successfully construct will be zero. Facebook is a VERY VERY VERY complex piece of software.

This is the process I took for learning PHP. Keep in mind, when I started with PHP I already had years of experience with UserLand Frontier's dynamic webserver and with Zope, so I had a running start.

First, you need to grasp the syntax of the language. If you don't have that solidly down, you obviously can't write anything. So build a regular HTML file and make sure it conforms to W3C standards (if there's an error, you can use a validator on the PHP output to find exactly where it is). In that page, have a number of elements: a passage of text including HTML formatting, a date display, an image and a form with a selection of input elements.

Copy the HTML file and change its extension to "template.php" and then, in another file called "index.php", try to write code that will dynamically construct the HTML in question for one element at a time. Then use <? php echo $whatever; ?> in the template file to output the values in the correct location.

Suppose you had this line in your HTML file:
<p>Today's date is <b>June 21, 2007</b>.</p>
In template.php, replace that line with
<p>Today's date is <b><?php echo $todays_date; ?></b>.</p>

Then make index.php like this:
<?php
$todays_date = 'June 21, 2007';
// create your other values here
require_once ('template.php');
?>
Now, obviously, tomorrow the date will be incorrect. So we need to generate the date string for the current time. Change the code to this:
<?php
$todays_date = 'June 21, 2007'; // static value
$todays_date = date('M j, Y'); // calculated value overrides
// create your other values here
require_once ('template.php');
?>
Note how I left the fake code in place and then replaced the value with the calculated one. When the calculation script is running correctly, you can delete the static placeholder. If the dynamic code does not work for some reason, comment it out and run the page again, and the plain text version will return to play.

You can follow the same basic pattern to develop more complex data. Just break the puzzle down into pieces and do each one individually. Remember the correct order for developing software:
1) Make it work.
2) Make it work CORRECTLY.
3) Make it work CORRECTLY and FAST.
Filing to follow this order will mean you are optimizing code that's not generating the right product, and that way lies the land of Unfinished Projects. :-)

Once you are comfortable in PHP — I would allow about a year of tinkering and reading stuff, assuming you work on it every day — then you'll be ready for more advanced projects (but still not Facebook). Once you understand the language well enough to build an automatic templating and navigation system for a PHP website (that generates the page code, including the menus, automatically from the content on eaqch page request), you're ready to move into content management systems. I recommend Drupal for PHP developers; it's a well designed and secure CMS framework. I have been using Drupal for about six weeks now developing a new socializing site. It's coming along nicely, and we're ahead of schedule for our July 7 launch.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[] - ihoston - 04-28-2014, 12:50 AM
[] - David D - 04-28-2014, 12:56 AM
[] - poorcocoboiboi - 04-28-2014 12:57 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)