WordPress Websites for Engineers: Elevate Your Brand
Introduction to php
1. INTRODUCTION TO PHP
by Jorge Garifuna
info@GariDigital.com
@jgarifuna
jgari.com/resume
1
2. WHAT IS PHP?
Recursive acronym for PHP: Hypertext Preprocessor
Widely-used open source general-purpose scripting
language
Suited for web development and can be embedded
into HTML
2
7. WAYS TO LEARN PHP
1. By writing straight PHP from scratch
2. By using PHP frameworks
CakePHP
Symfony
Zend
3. By using Quick Web Application Builder (QWAB)
7
8. SETTING UP
ENVIRONMENT
Mac OS (ready or MAMP or )
http://www.coolestguyplanettech.com/how-to-install-php-mysql-apache-on-os-x-10-6/
Windows (XAMPP or WAMP)
http://www.apachefriends.org/en/xampp.html
Linux
Ubuntu: sudo apt-get install php5 mysql-server apache2
CentOS: http://www.howtoforge.com/quick-n-easy-lamp-server-centos-rhel
8
9. TOOLS
Text Editor or IDE
PSPad
netbeans
eclipse
Database administration
phpMyAdmin
Sequel Pro
MySQL Workbench
9
11. CONNECTING TO
DATABASE
<?php
if (mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD)){
if (mysql_select_db(DB_NAME)){
return true;
}
}
die("nDB ERROR: " . mysql_error() . "n");
?>Text
11
12. PROCESSING FORMS
file name: myform.html
<html> file name: myform.php
<body>
<form action="myform.php" method="post"> <html>
<body>
<p>Your Name: Your name is:
<input type="text" name="yourname" /><br />
<?php echo $_POST['yourname']; ?><br />
E-mail:
<input type="text" name="email" /></p> Your e-mail:
<p>Do you like this website? <?php echo $_POST['email']; ?><br />
<input type="radio" name="likeit" <br />
value="Yes" checked="checked" /> Yes
<input type="radio" name="likeit" Do you like this website?
value="No" /> No
<input type="radio" name="likeit" value="Not <?php echo $_POST['likeit']; ?><br />
sure" /> Not sure</p> <br />
<p>Your comments:<br /> Comments:<br />
<textarea name="comments" rows="10"
cols="40"></textarea></p> <?php echo $_POST['comments']; ?>
<p><input type="submit" value="Send it!"></ </body>
p> </html>
</form>
</body>
</html>
12
13. CONNECTING TO FACEBOOK
AND TWITTER WITH
HYBRIDAUTH
http://oyanix.com/opensource/hybridauth/
13
14. SPEEDING UP PROTOTYPING WITH
QUICK WEB APPLICATION
BUILDER (QWAB)
Generates complete functional web-based
applications through a web-based interface in three
easy steps
Would you like to see it in action?
http://garisoft.com/qwab
14
15. HOSTING RESOURCES
FOR PHP
hostmonster.com
hostgator.com
godaddy.com
15