Tutorial-building Dynamic Websites

Welcome. Please Login, Register, Or Activate! 
type your username and password to login
Date: November 21, 2009, 03:47 AM
430263 members and 297389 Topics
Latest Member: straph
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Webmasters (Moderators: OmniPotens, yawa-ti-de)  |  Tutorial-building Dynamic Websites
Pages: (1) (2) (3) (4) (5) Go Down Send this topic Notify of replies
Author Topic: Tutorial-building Dynamic Websites  (Read 6354 views)
webdezzi (m)
Tutorial-building Dynamic Websites
« on: November 05, 2008, 06:47 AM »

I am very impressed reading the website design tutorial started by ncpat, Thats the easiest tutorial i have ever seen.
And i think it wont hurt anyone if i start a tutorial on using server side languages, since PHP seems to have the largest user group especially on this forum

I will be focusing on PHP/MySQL

I can't go through the whole of Nairaland, so i need someone to point me to a similar thread if it exists

else, I will move on

I will try to make it as easy as possible, with snapshots.

(PHP Gurus are welcome to contribute)

EDITED:
We will be having a seminar on the 5th of March in Osun State (I chose my root first  Tongue )
If you live very close to Osun state and you dig my tutorials, You can reserve a space. Call me on 08029037890.

For my state, I decided it will be N5,000 per participant.

Other states will follow and will range from N15, 000 to N20,000.
Its going to be 100% practical as we  will be building a website for a fictitious school in osun state.
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #1 on: November 05, 2008, 10:40 AM »

The end goal of this tutorial will be to create a simple website that will display news content, The news will be posted by the admin and we will be building that too.

First, we will be setting up a web server (a software meant to send pages to the browser), that will help serve pages to our users the same way the internet does

but this time, on our local computer, we wont be using the internet to develop our website because the internet will slow down our development speed as we will need to upload files to the internet every time we make changes

with the local web server, things will be very fast.

Question: Why use a web server (in this case on our local computer), why not just build our site and save it on my system and run it from there?

Reason: we need to use the same protocol used over the internet: The HTTP (Hyper Text Transfer Protocol)
This way, our pages are parsed (processed, executed, run) by the web server before reaching the user.

we have many free HTTP servers but we will be focusing on the Apache HTTP server,
so just like 9ice, let's go there

http://httpd.apache.org/

Images
1. follow that link
2. make sure you download the binary version if you are not a pro
3. you should have something that looks like that



* webdezzi.com_1.jpg (28.76 KB, 652x164 )

* webdezzi.com_2.jpg (33.7 KB, 652x164 )

* webdezzi.com_3.jpg (15.36 KB, 652x164 )
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #2 on: November 05, 2008, 10:50 AM »

Next, we need to install the Apache HTTP server we just downloaded

Images
1. double click the software
2. click next, accept any term & conditions you see
3. enter the text as in this pix and install for all users, that way, you dont have to manually start apache server all the time
4. use the typical installation, and install

(you may see a black screen pop up and disappear, just ignore it) then click finish


* dealersnest.com_1.JPG (35.18 KB, 526x411 )

* dealersnest.com_2.JPG (39.51 KB, 517x399 )

* dealersnest.com_3.JPG (34.03 KB, 519x400 )

* dealersnest.com_4.JPG (30.71 KB, 514x400 )
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #3 on: November 05, 2008, 11:04 AM »

If you see the small icon in the image in your system tray

Then congrats, you have successfully installed the Apache HTTP server on your local computer

you should then open your web browser and type http://localhost/

you should see the second image

if you don't see that in your browser, click on the icon on the system tray to start the server
if any of these steps fails, start all over.


NEXT, we will look at how we can run our pages and where we need to store our pages so that all works fine.
see you tomorrow.


* www.dealersnest.com_1.jpg (3.26 KB, 138x60 )

* www.dealersnest.com_2.JPG (16.58 KB, 396x307 )
kolexinfos
Re: Tutorial-building Dynamic Websites
« #4 on: November 05, 2008, 08:09 PM »

Thanks for your effort I really appreciate.
I use IIS as web server and i av configured PHP and MySQL on my system but I need a e-book that teaches one to do basicthings step by step so as to pick up all the experience from the scratch.


I also av  a small problem here with creating databases from cpanel.I av setup a site using Dreaweaver I av uploaded the pages to my web host but i am not really sure of how to create databases using the cpanel Phpmyadmin so that makes it impossible to connect to the database that would be used for the html forms on my site.

please my email is kolexinfos@yahoo.co.uk if u can help on a personal basis
webguru
Re: Tutorial-building Dynamic Websites
« #5 on: November 05, 2008, 08:37 PM »

pls explain how to use apache in deploying web devt projects on a local server ie connecting to apache from other systems
kehers (m)
Re: Tutorial-building Dynamic Websites
« #6 on: November 05, 2008, 09:56 PM »

@kolex
Guess u wont b needg an ebook nw as someone is taking his time to explain better. As regards d db, u can only set dat up directly frm your cpanel and not d cpanel PMA. Go to database in your CPanel nd select add new. Any db u add will show up when u now open PMA. Note dat your db name will b prefixed wt your cpanel username. So make d changes to your scripts. Dont forget your username nd pwd too
Quote
mysql_connect('localhost', 'username', 'pwd');
mysql_select_db('username_dbname');

@webguru
Do u mean an intranet thing? Dat has to do with networkg. A system wil be set as d server (with d php, mysql, web server nd project installed on it) nd assigned a static IP. All other connected systems (PCs) can den access d app via d IP. eg http://10.10.2.9/NL instead of http://localhost/NL (on hosting machine) or http://NL.com (internet). Dats just a simple flow though. There are other things. In any case, the major work is d networkg part. All systems dat wil access d project must be networked to d server.
dre101 (m)
Re: Tutorial-building Dynamic Websites
« #7 on: November 06, 2008, 09:01 AM »

@Webdezzi, thanks for the good work, I really appreciate it.
abes (m)
Re: Tutorial-building Dynamic Websites
« #8 on: November 06, 2008, 01:15 PM »

@webdezzi
can i use WAMP server as it comes with apache, mysql and php in one package?
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #9 on: November 06, 2008, 01:32 PM »

Kehers has answered it all.

@abes

Yes, you can use wamp, in fact i personally use wampserver 2.0 but it will be very bad for newbies to use wamp.
It will make them feel that is all they need to know.

Infact, i should be showing them how to install the files from source but if i try that, we will spend forever building the website as there would be many questions.

Now back to today's class
dre101 (m)
Re: Tutorial-building Dynamic Websites
« #10 on: November 06, 2008, 01:57 PM »

we are set  Grin
kehers (m)
Re: Tutorial-building Dynamic Websites
« #11 on: November 06, 2008, 02:08 PM »

@abes
I was patiently waiting for webdezzi to conclude talks on installing Apache, mysql and php before I chip in the boundled softwares - softwares that have mysql, php and apache together so that u just install everything at a go. Being honest, Iv never installed the 3 seperately (I actually use AppServ). But then, this is an opportunity to learn how to do it one by one.
You see, those softwares - appserv, wamp, easyphp and co have their disadvantages. For one, they come with settings that the author thinks is best which is not in all cases correct. For example, there are some extensions (think of this as additional functionalities) that I'd love the current php I run locally to come with. Examples are sqLite, ffmpeg-movie, wbxml and memcached. But since I didnt compile PHP myself, these are out.
What am I driving at? When u do things urself, you have better edge.
uche1 (m)
Re: Tutorial-building Dynamic Websites
« #12 on: November 06, 2008, 02:54 PM »

we are still waiting,
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #13 on: November 06, 2008, 03:08 PM »

NEXT, we will look at how we can run our pages and where we need to store our pages so that all works fine.

If you are not new to computers, you must have noticed that files on your computer always end with an extension
e.g
.txt -Text document, opens with notepad
.jpg -Image document, opens with ms paint or other graphics program
.html -Hypertext markup file, opens with your default web browsers

Now lets focus on .html file,

copy the html code below, open notepad up and paste it in it

Quote
<html>
<head>
<title>Building Dynamic Website Tutorial</title>
</head>
<body>
<table width="777" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#333333">
  <tr>
    <td bgcolor="#FFCC66"><h1><br>
     &nbsp; MYFIRSTWEBSITE.COM<br>
      <br>
    </h1></td>
  </tr>
  <tr>
    <td><br><p>&nbsp;
      Please take time to read what i have for you in the news section<br>
      &nbsp; <a href="#"><strong>Click here to get news update</strong></a></p>
    <p>&nbsp;</p>
        <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p></td>
  </tr>
  <tr>
    <td bgcolor="#666666"><div align="center" style="font-size: 12px; color: #CCCCCC;">HOME | ABOUT | NEWS </div></td>
  </tr>
</table>
</body></html>

now save the file as .html
Quote
To save the file as .html, from your notepad, click file >save as
you will see a save as dialog window
where you have filename, type "tutorial.html", plus the double quote
hit save (image 1 below)

Or

where you have the filename, type tutorial.html, without the double quote
set the Save as type: to all files
hit save (image 2 below)

windows is smart enough to know that you want the file in .html format and not .txt
if you end up with an icon like you have in image 3 below, then you have not followed the step properly


make sure you save it on your desktop for now


* www.dealersnest.com_cars_nigeria.JPG (11.49 KB, 455x150 )

* used_cars_dealersnest.JPG (12.41 KB, 461x132 )

* dealersnest.com_cars_nigeria.JPG (10.19 KB, 216x194 )
Seton (m)
Re: Tutorial-building Dynamic Websites
« #14 on: November 06, 2008, 03:32 PM »

@Webdezzi,
Thanks for the good work, Remember to add creating forms using PHP
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #15 on: November 06, 2008, 04:30 PM »

@seton, its part of what we will be accomplishing with this tutorial

Next, double click on the file from your desktop and it will open in your default web browser showing
(image 1 below)

if you look at the location of the file from the browser, it says something similar to this

file:///C:/Documents and Settings/Oluwaseun Emmanuel/Desktop/tutorial.html

That is not what we want,

we want to open the file using the HTTP protocol
so we need to put the file in a directory (directory means folder) where our Apache will be able to locate the file.
and serve it using the HTTP protocol (i know that is tautology, but we need it here)

where is that directory?

it is somewhere in your apache installation directory (folder)
Let's go there

open My computer, double click on the Local Disk (C:)
from there, open Program Files > Apache Software Foundation > Apache2.2 > htdocs

by default, Apache looks inside htdocs and attempts to serve files inside it,
As far as apache is concerned, if your file is not in that folder
it doesn't exist

he would just say 404 (thats an error code for file not found)

before we relocate our tutorial.html, let us look at the index.html in that directory
when you type http://localhost without specifying the filename

Apache tries to complete the rest for you by look out for an index.html file
if index.html is present, it loads it, if absent, it displays the content of the directory

confirm this by renaming index.html in the htdocs directory to something else, e.g renamed.html

now from your web browser, try http://localhost

and see what happened

This little logic is what you will use to tell apache what your homepage is
for instance, tutorial.html is what we want as our homepage, so we will just rename it to index.html (don't do that yet) and apache will load it once we type http://localhost/

so if we were to be on the web, typing http://www.dealersnest.com will load the index file placed in the folder of that website

Now, for this tutorial
we will be creating a new folder inside the htdocs folder and we will name the folder "tutorial"
then copy the tutorial.html and paste it inside the tutorial folder

Now, you should have the tutorial.html file inside the tutorial folder, and the tutorial folder should be inside the htdocs folder

to access the tutorial.html file, just type, http://localhost/tutorial/tutorial.html
(you should begin to get a picture of what is going on)
make sure you use a forward slash "/" when using localhost to access a file

So lets say we have another website to design, we will create another folder inside the htdocs folder for that website
 and access it typing http://localhost/newsite

That helps keep things organized



* www.webdezzi.com.JPG (38.07 KB, 508x389 )
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #16 on: November 06, 2008, 05:55 PM »

Now, rename the tutorial.html to index.html

so we wont be accessing the file this way anymore  -> http://localhost/tutorial/tutorial.html
 
instead, we will just type this and we are fine  -> http://localhost/tutorial


after typing that, you should end up with a page that says, MYFIRSTWEBSITE.COM

with a link that says, click here to get news update. don't worry, the link has been disabled.


That will be all for today, you can keep playing with this till tomorrow when i will introduce you to a notepad called notepad++, nothing big, we just want to take advantage of the code coloring of that notepad.

That way, its easier to spot out coding mistakes.
MT
Re: Tutorial-building Dynamic Websites
« #17 on: November 06, 2008, 10:56 PM »

@webdezzi

For you to make out time to add values to the life of others, without any form of compensation, you deserve more than a pat at the back. All I can say is "May God Bless You". Thanks we all appreciate your kind gesture
abes (m)
Re: Tutorial-building Dynamic Websites
« #18 on: November 07, 2008, 04:02 PM »

Thanks man, your step-by-step method is the best around, keep it up Cool Cool
webguru
Re: Tutorial-building Dynamic Websites
« #19 on: November 07, 2008, 04:56 PM »

@ kehers

thats wot i meant.

The problem wld b the NL part in http://localhost/NL
and ports to use

id love to deploy php for biz apps
kehers (m)
Re: Tutorial-building Dynamic Websites
« #20 on: November 07, 2008, 05:30 PM »

@webguru
You see, every PC has a default IP (http://127.0.0.1/). If u type that in your PC u will sure see your localhost. The localhost is just an alphabetic representation of this IP. To deploy your app on a network, u simple deploy the app on the central PC (that will serve as the server) as you will normally on your local system. The PC serving as the server will be assigned a static IP say 10.10.2.9 (as an example). It is with this IP that the other connected systems will access the app. If for example 3 PCs are networked (A, B, C) and we want to use C as the server, we will install apache, php, mysql and other things on it and put the application there. A and B can then access the app by typing http://10.10.2.9/appurl as long as C is on and the app is working.
Hope that makes sense?
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #21 on: November 07, 2008, 07:57 PM »

@webguru

I think it will be better if you don't confused port with IP,
they are separate terms, and you should not be talking about port here

and i forgot to mention that typing http://127.0.0.1 will also point you to http://localhost

webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #22 on: November 07, 2008, 09:57 PM »

now, lets go grab our notepad from sourceforge

http://sourceforge.net/project/showfiles.php?group_id=95717&package_id=102072

I googled for "notepad++ download" and got that link

Image 1- click that link to download the notepad++
Image 2 - You should end up with that chameleon icon

I expect you to be a pro at installing softwares by now, as we have previously installed Apache
so go ahead and install the notepad with the default setting (default mean, the ways it is, without changing any settings)

Image 3 - That the notepad.

The good thing about this notepad is that he understands most programming languages, all you have to do is to tell the notepad what language you intend to code in
and the notepad will start coloring your codes in that language

I am not very comfortable with the default color settings of this notepad (for PHP) so we will be modifying the colors.

I will show you how


* www.dealersnest.com.gif (5.94 KB, 451x191 )

* www.dealersnest.com2.gif (10.29 KB, 451x191 )

* www.dealersnest.com_3.gif (58.39 KB, 535x373 )
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #23 on: November 07, 2008, 10:22 PM »

well, i changed my mind, you can go ahead and set the colors to your preferred color, i will go ahead and reset mine

to reset colors,
follow image 1

Image 2 - you select that language, then change colors for each item under style
(newbies may find it hard to do this, dont worry, leave it as it is and exit the configurator, you will catch up later)

image 3 - thats where you need to select the language, in our case, it is PHP

and we are on our way to programming.


But before then, we need to understand the basics of what we are about to do.


* www.dealersnest.com.gif (10.28 KB, 587x134 )

* www.dealersnest.com_2.gif (15.17 KB, 625x428 )

* www.dealersnest.com_3.gif (9.85 KB, 220x714 )
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #24 on: November 07, 2008, 11:24 PM »

GOAL OF THIS TUTORIAL: create a page that will display news, the news will be posted by the admin.

Before we start, we need to understand that, we need a storage system to help us store the news so that the news will always be available to whoever requests for it.

Now, look at this storage system as your wallet,

everytime you need money, you reach for it
everytime we request for the news page, our php script reaches for the storage (called database, programmers prefer to call it DB)

Now, we have installed Apache that will serve our pages,
we need to install a "storage system" (Database) in this case, it is MySQL Database

Note that the script or code that we will be writing is also a software application, because we have it on the web, it is call a web application

so we need a web application language to help us handle the programming part
unfortunately, Apache does not come with the ability to do this.

we will need to install php application sever- this is php itself
once you install it, this PHP application server will continue to run on the Apache HTTP server

pages ending with .php will then be parsed by the PHP application server, the result is passed over to the Apache HTTP server and sent to the user who requested it.

Look at it this way,
Apache is the Landlord
PHP is the tenant

everytime someone comes around asking for a php page from Apache,
Apache consults his tenant, who in turn tells Apache how to treat the visitor

Look at this again

someone came asking for .html page, even though the PHP server is running, He does not have to interfere
and that alone makes .html pages load faster than php pages (although the difference is negligible)
because, the landlord can attend to the visitor without having to consult his tenant

bottomline, if you have a page that has no php code in it, always name such page .html


Now let us go install PHP from php.net
and MySQL from mysql.com

visit those sites and download what they have.
below are the final links

mysql - http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-essential-5.0.67-win32.msi/from/http://mysql.skynet.be/
php -    http://www.php.net/get/php-5.2.6-win32-installer.msi/from/ar.php.net/mirror

they are fairly large files, download them tomorrow, we will be installing them.
RuuDie (m)
Re: Tutorial-building Dynamic Websites
« #25 on: November 08, 2008, 01:32 AM »

Nice one webdezzi. . . . .  you're a GEM  Grin


Pls i have a couple of questions:

1. can i use this PHP/MySQL/Apache combo on a window XP proffessional system that already has IIS running?
2. can i use this PHP/MySQL/Apache combo on a window XP Home Edition system?


Thanks for the education man!
kehers (m)
Re: Tutorial-building Dynamic Websites
« #26 on: November 08, 2008, 06:27 AM »

@ruudie
Ds softwares av different versns for d various OS around - b it windows, linux, wateva. Just look around d download page of d respective site. D windows versn which webdezzi posted its links (bet he is assuming we all run on windows) wil work for your OS - XP whateva or Vista whateva.
And back to your nö 1 questn, do u mean running apache and IIS? Iv not tried dat out before but to be on d safe side, I think u may have to turn off one to use d other esp if the two listens to d same port.
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #27 on: November 09, 2008, 01:11 PM »

@ruudie

yes, but you have to stop one for the other

So if you want to write asp, you might want to stop apache HTTP, from the system tray.
please note that if you prefer IIS, then forget about Apache, so we will be installing PHP on IIS

and yes again, you can use the 3 on windows xp home edition

@kehers,
yes, i assume everyone is on windows, if you are on linux, please go ahead and figure things out (you are definitely not new to installations)

Sorry, tutorials continue tomorrow
Seton (m)
Re: Tutorial-building Dynamic Websites
« #28 on: November 10, 2008, 11:35 AM »

@Webdezzi,

You have challenged me a lot to think about starting on what will impact the life of so many persons. Keep up the good work.

Now it is really true that, the best way to help ourselves is to help other people solve their problems
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #29 on: November 12, 2008, 11:44 AM »

Lets install our PHP, (it really does not matter which one you install first, mysql or php)

However, you will need to install a web server before php, because without the web server, php can not work
see for yourself when installing php

It will ask what web server you want to use,
so for those asking if you can install php on iis, look at the picture and see where you have to do that.

Note: you will need to stop all running webservers for installation to be successful

For mysql, you can install it even before installing a webserver, thats because it is a service that can run independently

If you have problems with installing these guys, make a post and you will get help.


* www.dealersnest.com.jpg (34.33 KB, 511x400 )

* www.dealersnest.com2.JPG (27.05 KB, 506x396 )

* www.dealersnest.com3.JPG (26.69 KB, 503x389 )

* www.dealersnest.com4.JPG (33.77 KB, 507x389 )
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #30 on: November 12, 2008, 11:48 AM »

look at the last picture above, compare it to this one i just posted,

you will be enabling EXTENSIONS and EXTRAS, so that you don't have to go looking for them later on.
and the manual, should come with it too if you enable them



* www.dealersnest.com5.JPG (34.04 KB, 509x395 )
webdezzi (m)
Re: Tutorial-building Dynamic Websites
« #31 on: November 12, 2008, 09:42 PM »

follow the procedures below for MySQL installation.



* www.webdezzi.com2.gif (34.42 KB, 546x416 )

* www.webdezzi.com3.gif (26.25 KB, 546x416 )

* www.webdezzi.com4.gif (36.99 KB, 546x416 )

* www.webdezzi.com5.gif (38.67 KB, 546x416 )
 How To Start An Online Radio Station  Dynamic Web Design Tutorials Ft Javascript,Ajax,DOM,PHP,MySQL...  Nudist Camp Nude Celebrity  Page 2
Pages: (1) (2) (3) (4) (5) Go Up Send Topic to Friend by E-mail Reply 


Sections: Autos/Cars (2) Jobs/Vacancies (2) (3) Career Talk Education General(2) Politics Romance Computers Phones Travel
Sports Fashion Health Religion Celebrities TV/Movies (2) Music/Radio (2) Books Webmasters Programming

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa. See also: Nairalist Classified Ads
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.