Creating a Social Network : Part 1 : Introduction to PHP

Status
Not open for further replies.

Baljeet

Member
Jan 31, 2011
76
0
Creating a Social Network : Part 1 By Blimp

Hi everyone,

Not been around for a while, so I thought i'd start off by making a few tutorials. So, without further ado, here we go!

This tutorial, although classed as beginner, requires : basic understanding of HTML, A web host, a web site (Get on for free here : ) and a text editor/Dreamweaver.


Getting an idea

Let's be honest, there are masses of web sites out there and social networks that practically take up the market. But where there are triumphs, there are always weaknesses. In this tutorial, we'll look at ways we can bring other social networks down below us and in theory, produce a better website than them.
Being factual, Facebook is definitely the leading social network. It boasts over 500million users, Fan pages, Profiles, Chat (Although very bad) and a lot more features I really don't want to type out.
But the point is, while we can make a great website, there is no way we are going to be able to take out such giants like Facebook or Myspace. So the idea is to adapt around them, make something that integrates with it. Twitter, for example, has ways of connecting to Facebook. This is exactly what we need to do.

Social networks are getting boring, it's a true statement, so we need something that will liven it up a bit, something new.

So lets get to work..

Building a stable base

A website should always be planned first, no matter how big or how small it is. For the sake of your time and mine, we'll go with my plans. You can adapt them however you like then.

Step 1
We need to set-up our files/folders.
Firstly create a folder on your desktop, name it whatever you want the site to be called. Placing it on your desktop means we have a quick access to our files when logging in. Now enter the folder and create more folders with these names:

_admin
_sql
_connects
images
apps
shared
_data
settings


Remember to have the dash ( _ ) before sql, admin, data and connects. Now create these files in the same folder (Blank files) :

index.php
login.php
register.php
home.php
settings.php
style.css
logout.php



We now have our base files.
Let's open up our file "index.php" in either notepad or Dreamweaver (Make sure you're on code view).
Now we have our file open, we're going to add a bit of code.
Code:
<?
include("settings/settings.php");
echo("<title>$site_name | $site_motto</title>");
echo("<link href="style.css" rel="stylesheet" type="text/css" />");
echo("PHP works on my server, YAY!");
?>

So what does this code do? Well, the first line includes our file settings/settings.php (Which we will code later). Include basically means include all the code from the other file. Which is great for loading things like site names (Which we are using) as you dont have to change the site name on every single page.

echo basically means print, or show, everything after the echo(" onto the page. I like to think of PHP as a two file system. When using the ECHO function, we're creating another file in the sky (Which the user sees) that contains all the information on.

If you are familiar with HTML, you may see that line 3 is actually HTML. This is including our style sheet into our site, which will come in handy later when we want our site to look graphical.

The <? before the coding and the ?> after the coding basically tells our web server that our file is a PHP file.

Now save your file by pressing CTRL+S.

We now have our base index file. In the next tutorial I will be showing you how to turn your small amount of coding there, into something like the attached file.

THE ATTACHED FILE IS THE FINISHED PRODUCT OF TUTORIAL 2


Thanks for reading, the next tutorial will be up soon!

Comment!

All Credits goes to one who really made this...
 
Status
Not open for further replies.

Users who are viewing this thread

Top