It's Alive



                        Add life to your static pages
                                                 --rev...
HTML is static and boring




© 2010, OpenThink Labs. All Rights Reserved
PHP brings web pages to life




© 2010, OpenThink Labs. All Rights Reserved
Form help us capture the data




© 2010, OpenThink Labs. All Rights Reserved
Forms are made of HTML



                      HTML acts on the Client and ....

                                PHP acts...
Use PHP to Access the Form Data


                           $_POST['var_name'] ...... [1]
                           $_GE...
PHP scripts must live on a server!




src: http://www.flickr.com/photos/keith324/185799373/

© 2010, OpenThink Labs. All ...
Get your PHP scripts to the server



 Copy the example scripts to the root directory of the
                   server, or...
The server turns PHP into HTML




© 2010, OpenThink Labs. All Rights Reserved
Deconstructing Owen's PHP scripts




       //open : examples/ch01/final/aliens/report.php




© 2010, OpenThink Labs. Al...
A few PHP rules to code by
 ●   PHP code always enclosed by <?php and ?>
 ●   Every PHP statement must end with semicolon ...
Finding the perfect variable name
 ●   The first character must be a dollar sign ($)
 ●   A variable name must be at least...
Variables are for storing script data
 ●   $where = “at home”
 ●   $_POST[“email”] = “twetme@someplace.com”




     //see...
Sending Email with PHP

     bool mail ( string $to , string $subject , string $message [, string
        $additional_head...
What have you learned already




© 2010, OpenThink Labs. All Rights Reserved
●   #svnadmin create /home/svn/training
 ●   #apt-get install libapache2-svn
                                      <Locati...
Creating Apache Alias

           Alias /headfirst/ "/path/to/examples"
           <Directory "/path/to/examples">
       ...
Create Database
 ●   mysql> create database headfirst ;
 ●   mysql> grant all on headfirst.* to
     'headfirst'@'localhos...
Add New Connection on Power Architect
 ●   Connection → Add Source Connection → New
     Connection




© 2010, OpenThink ...
Create new Table Schema




© 2010, OpenThink Labs. All Rights Reserved
Forward Engineer the Schema




© 2010, OpenThink Labs. All Rights Reserved
●   DOM – Document Object Model
      ●   CSS : CSS selector
            –   #firstname {background-color:red;font-wight:b...
Q&A


                                              Thanks! ^_^




© 2010, OpenThink Labs. All Rights Reserved
Upcoming SlideShare
Loading in …5
×

Mastering PHP - it's alive (1)

1,734 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,734
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Mastering PHP - it's alive (1)

  1. 1. It's Alive Add life to your static pages --rev01-- Wildan Maulana wildan.m@openthinklabs.com © 2010, OpenThink Labs. All Rights Reserved
  2. 2. HTML is static and boring © 2010, OpenThink Labs. All Rights Reserved
  3. 3. PHP brings web pages to life © 2010, OpenThink Labs. All Rights Reserved
  4. 4. Form help us capture the data © 2010, OpenThink Labs. All Rights Reserved
  5. 5. Forms are made of HTML HTML acts on the Client and .... PHP acts on the SERVER © 2010, OpenThink Labs. All Rights Reserved
  6. 6. Use PHP to Access the Form Data $_POST['var_name'] ...... [1] $_GET_['var_name'] ...... [2] 1. http://php.net/manual/en/reserved.variables.post.php 2. http://php.net/manual/en/reserved.variables.get.php © 2010, OpenThink Labs. All Rights Reserved
  7. 7. PHP scripts must live on a server! src: http://www.flickr.com/photos/keith324/185799373/ © 2010, OpenThink Labs. All Rights Reserved
  8. 8. Get your PHP scripts to the server Copy the example scripts to the root directory of the server, or ..... You can setup a new virtual host © 2010, OpenThink Labs. All Rights Reserved
  9. 9. The server turns PHP into HTML © 2010, OpenThink Labs. All Rights Reserved
  10. 10. Deconstructing Owen's PHP scripts //open : examples/ch01/final/aliens/report.php © 2010, OpenThink Labs. All Rights Reserved
  11. 11. A few PHP rules to code by ● PHP code always enclosed by <?php and ?> ● Every PHP statement must end with semicolon (;) ● If there is any PHP code in a web page, it's a good idea to name the file on the web with .php not .html ● PHP variable must begin with a dollar sign ($) © 2010, OpenThink Labs. All Rights Reserved
  12. 12. Finding the perfect variable name ● The first character must be a dollar sign ($) ● A variable name must be at least one character in length ● The first character after the dollar sign can be a letter or an underscore (_), and characters after that can be a letter, an underscore, or a number ● Spaces and special character other than _ and $ are not allowed in any part of variable name ● (+) Use lowercase for variable name ● (+) Separate words in a multi-word variable name with under score © 2010, OpenThink Labs. All Rights Reserved
  13. 13. Variables are for storing script data ● $where = “at home” ● $_POST[“email”] = “twetme@someplace.com” //see : slide 6, for more information about $_POST and $_GET variable © 2010, OpenThink Labs. All Rights Reserved
  14. 14. Sending Email with PHP bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) //see : http://id2.php.net/manual/en/function.mail.php © 2010, OpenThink Labs. All Rights Reserved
  15. 15. What have you learned already © 2010, OpenThink Labs. All Rights Reserved
  16. 16. ● #svnadmin create /home/svn/training ● #apt-get install libapache2-svn <Location /svn/training> DAV svn SVNPath /home/svn/training AuthType Basic AuthName "Training subversion repository" AuthUserFile /etc/subversion/passwd <LimitExcept GET PROPFIND OPTIONS REPORT> Require valid-user </LimitExcept> </Location> ● svn mkdir -m "created default directory structure" http://training.o2labs/svn/training/trunk http://training.o2labs/svn/training/tags http://training.o2labs/svn/training/branches © 2010, OpenThink Labs. All Rights Reserved
  17. 17. Creating Apache Alias Alias /headfirst/ "/path/to/examples" <Directory "/path/to/examples"> Options Indexes MultiViews FollowSymLinks AllowOverride None </Directory> © 2010, OpenThink Labs. All Rights Reserved
  18. 18. Create Database ● mysql> create database headfirst ; ● mysql> grant all on headfirst.* to 'headfirst'@'localhost' identified by 'jagungbakar' ; ● mysql> flush privileges ; © 2010, OpenThink Labs. All Rights Reserved
  19. 19. Add New Connection on Power Architect ● Connection → Add Source Connection → New Connection © 2010, OpenThink Labs. All Rights Reserved
  20. 20. Create new Table Schema © 2010, OpenThink Labs. All Rights Reserved
  21. 21. Forward Engineer the Schema © 2010, OpenThink Labs. All Rights Reserved
  22. 22. ● DOM – Document Object Model ● CSS : CSS selector – #firstname {background-color:red;font-wight:bold} – .input → css class ● JavaScript - jQuery – $(“#firstname”).val() ; © 2010, OpenThink Labs. All Rights Reserved
  23. 23. Q&A Thanks! ^_^ © 2010, OpenThink Labs. All Rights Reserved

×