Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Creating a Social Network : Part 1 : Introduction to PHP


  • Please log in to reply
14 replies to this topic

#1 Blimp

Blimp

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 199 posts
  • Location:West Sussex, England
  • Programming Language:Java, C++, C#, PHP, (Visual) Basic, Python, JavaScript, Transact-SQL

Posted 17 December 2010 - 12:50 PM

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 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.
<?
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!

Attached Thumbnails

  • tut2..jpg

Edited by Alexander, 03 November 2011 - 01:18 PM.
Removed referral

  • 4

#2 Rameek

Rameek

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 15 January 2011 - 06:18 PM

Yea i can't wait untill part 2 get up.
  • 0

#3 fazlerocks

fazlerocks

    CC Newcomer

  • Just Joined
  • PipPip
  • 12 posts

Posted 18 January 2011 - 06:51 AM

Wow.. Thats very interesting. I followed the steps and waiting for your second tutorial. :)

Thanks Man!!
  • 0

#4 CatchMeTux

CatchMeTux

    CC Regular

  • Member
  • PipPipPip
  • 39 posts

Posted 25 July 2011 - 05:19 PM

Judging from the attached photo, it is merely like facebook and plurk(?).
  • 0

#5 Epatron

Epatron

    CC Resident

  • Just Joined
  • PipPipPipPip
  • 54 posts

Posted 27 July 2011 - 11:17 AM

Interesting!
I'm beginner PHP Coder and will read next tutorial for more knowledge of PHP !
I'm very thankful in this point already!
  • 0

#6 arif27

arif27

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 10 August 2011 - 05:13 PM

Nice...I hope for your next move
  • 0

#7 TheJoker

TheJoker

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 31 October 2011 - 12:13 PM

So, when is part 2 coming out?
  • 0

#8 bbqroast

bbqroast

    Codecall Addict

  • Senior Member
  • PipPipPipPipPipPip
  • 564 posts
  • Location:/etc/passwd

Posted 02 November 2011 - 02:12 PM

Never most likely, I get the feeling this tutorial has been deserted... Or maybe it was just an attempt to push traffic to 000webhost via his referral link.
  • 0
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#9 Alexander

Alexander

    YOL9

  • Moderator
  • 3963 posts
  • Location:Vancouver, Eh! Cleverness: 200
  • Programming Language:C, C++, PHP, Assembly

Posted 03 November 2011 - 01:19 PM

Or maybe it was just an attempt to push traffic to 000webhost via his referral link.


Good catch, it would be a shame if that were the case.
  • 0

All new problems require investigation, and so if errors are problems, try to learn as much as you can and report back.


#10 Blimp

Blimp

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 199 posts
  • Location:West Sussex, England
  • Programming Language:Java, C++, C#, PHP, (Visual) Basic, Python, JavaScript, Transact-SQL

Posted 17 November 2011 - 01:00 AM

Never most likely, I get the feeling this tutorial has been deserted... Or maybe it was just an attempt to push traffic to 000webhost via his referral link.



I actually lost the tutorials I created after formatting my hard-drive and completely forgetting about them. Without sufficient evidence, I feel that accusing somebody for something is a bad act. Especially when they're the one who worked on the tutorials. I may make another set, but at the moment, I really don't have the time.
  • 0

#11 bigboyDanny

bigboyDanny

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts
  • Learning:C

Posted 14 January 2013 - 11:42 PM

Whens part two ??
  • 0

#12 Blimp

Blimp

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 199 posts
  • Location:West Sussex, England
  • Programming Language:Java, C++, C#, PHP, (Visual) Basic, Python, JavaScript, Transact-SQL

Posted 14 February 2013 - 03:10 AM

Whens part two ??

Please read above, Danny. The tutorials I created were lost from a hard-drive failure, meaning all the files that I created could not be accessed anymore. I'm sorry for the disappointment.


  • 0