2. TABLE OF CONTENTS
WE WILL COVER THE BELOW TOPICS TODAY:
• TOPICS
1. Preliminaries
2. PHP Tutorial for WordPress
3. Anatomy of a WordPress theme
Mobile Augmented Reality
Intel Corporation
2 FOR ALL KINDS OF PURPOSES July 22, 2012
3. Topic #1:
Preliminaries
3 FOR ALL KINDS OF PURPOSES Intel Corporation
4. BASIC CONCEPTS:
Web Server Stacks
Web Applications
(WordPress)
PHP Parser
SOFTWARE (Server-side script)
Apache Web Server (80) MySQL DB Server (3306)
Operating System (Linux / MacOS / Windows)
HARDWARE SERVER (or PC)
Mobile Augmented Reality
Intel Corporation
4 FOR ALL KINDS OF PURPOSES July 22, 2012
5. BASIC CONCEPTS: 2. Web Server:
Client↔Server Interaction Response to the requested URL
based on the setting
Port: 80
1. USER: Request URL (via Web Browser) Host: wordpress.org
http://wordpress.org IP: 72.233.56.139
URL: /
Apache Web Server (80)
3.
4. Read and parse the corresponding file
Print the parsed webpage to the browser /home/wordpress/index.php
<html>
<body>
<div><?php echo “Wordpress”; ?></div>
</body>
</html>
Parse
<html>
<body>
<div>Wordpress</div>
</body>
</html>
Mobile Augmented Reality
Intel Corporation
5 FOR ALL KINDS OF PURPOSES July 22, 2012
6. Topic #2:
PHP Tutorial
for WordPress
6 FOR ALL KINDS OF PURPOSES Intel Corporation
7. PHP Tutorial for WordPress
• Contents
1. What is PHP? PHP vs. HTML
2. How do I insert PHP into a web page?
3. Variables
4. Conditional statements
5. Functions
• Reference
– http://adambrown.info/b/widgets/easy-php-tutorial-for-wordpress-
users/
Mobile Augmented Reality
Intel Corporation
7 FOR ALL KINDS OF PURPOSES July 22, 2012
8. PHP Tutorial:
1. What is PHP?
• PHP is Server-side script that makes webpage dynamic.
– Static Web page:
– <p>Today is July 22, 2012</p>
– Dynamic Web page:
– <p>Today is <?php echo date(“F j, Y”); ?>
• PHP code does not get sent to the browser, only the
HTML that the PHP parser produces.
Mobile Augmented Reality
Intel Corporation
8 FOR ALL KINDS OF PURPOSES July 22, 2012
9. PHP Tutorial:
2. How do I insert PHP into web page?
• PHP codes should be wrapped by <?php … ?> or <? … ?>
– <div>
– <?php
– $var1 = “Hi, WordPress!”; ⁄⁄ two slashes indicate that everything until
the end of the line is a comment
– $var2 = “Hi, Man!”;
– /*
– if your comment spans more than one line,
– like this one, use the slash-asterisk format.
– */
– echo $var1; echo “<br/>”;
– echo $var2; echo “<br/>”;
– ?>
– </div>
Mobile Augmented Reality
Intel Corporation
9 FOR ALL KINDS OF PURPOSES July 22, 2012
10. PHP Tutorial:
3. Variables (1/2)
• A variable is always written with $ at the beginning, and the
alphabetical words from the second letter.
• For string values, it should be enclosed with „ (apostrophe) or “
(quotes). Every line should be ends with ; (semicolon)
– <?php
– $nDate = 22;
– $myFirstName = “Barnabas”;
– $myFamilyName = „Kim‟;
– ?>
• Note that,
1. Case sensitive:
– e.g. $myname, $myName are totally different variables.
2. Does not allow to starts with „number‟ or „special character‟:
– e.g. $_myname (X), $1234 (X) are not correct.
Mobile Augmented Reality
Intel Corporation
10 FOR ALL KINDS OF PURPOSES July 22, 2012
11. PHP Tutorial:
3. Variables (2/2)
• To display the contents of a variable on the web page, just use
echo. You should allocate variables before using echo.
– <?php
– $nDate = 22;
– echo $nDate;
– ?>
• To append something to an existing variable, use . (dot)
– <?php
– $date = 22;
– $month = “July”;
– $year = 2012;
– $strToday = $month.” ”.$date.”, ”.$year;
– ?>
Mobile Augmented Reality
Intel Corporation
11 FOR ALL KINDS OF PURPOSES July 22, 2012
12. PHP Tutorial:
4. Conditional Statements
• Conditional statements checks condition before proceeding or to repeat
a block of code multiple times.
– Control statements:
– if .. elseif .. else
– <?php
– $var = 10;
– if($var == 5){
– echo “5 in the variable”;
– }else if($var > 5){
– echo “The variable has the value bigger than 5”;
– }else{
– echo “The variable has the value smaller than 5”;
–}
– ?>
– Loop: while, for, foreach (These are not covered in this tutorial.)
Mobile Augmented Reality
Intel Corporation
12 FOR ALL KINDS OF PURPOSES July 22, 2012
13. PHP Tutorial:
5. Functions (1/2)
• If a function is called (sometimes with input parameters), the
function returns values (sometimes not).
– <?php
– echo date(“Y-m-d”);
– echo time();
– include(“header.php”);
– ?>
• A function can be regarded as a variable.
– <?php
– if(date(“Y-m-d”) == “2012-07-22”){
– echo “Today is 2012-07-22”;
– }
– ?>
Mobile Augmented Reality
Intel Corporation
13 FOR ALL KINDS OF PURPOSES July 22, 2012
14. PHP Tutorial:
5. Functions (2/2)
There are two types of functions
1. Internal (built-in) functions:
– String, Variable, Image Functions, …
– Function Reference: http://www.php.net/manual/en/funcref.php
– e.g.
– <?php
– $var1 = “Hello!”;
– echo str_replace(“He”, “”, $var1); // llo!
– ?>
2. User-defined functions
– <?php
– function add($a, $b){
– return $a+$b;
– }
– echo add(100, 200); // 300
– ?>
Mobile Augmented Reality
Intel Corporation
14 FOR ALL KINDS OF PURPOSES July 22, 2012
15. Topic #3:
Anatomy Of A
WordPress Theme
15 FOR ALL KINDS OF PURPOSES Intel Corporation
16. Anatomy of a WordPress theme
• Contents
1. Main Parts
2. Sections for “The Loop”
3. The Loop
4. Additional Files
5. The Extras
• Reference
– http://yoast.com/wordpress-theme-anatomy/
Mobile Augmented Reality
Intel Corporation
16 FOR ALL KINDS OF PURPOSES July 22, 2012
17. Anatomy of a WordPress theme:
Main Parts
Mobile Augmented Reality
Intel Corporation
17 FOR ALL KINDS OF PURPOSES July 22, 2012
18. Anatomy of a WordPress theme:
Sections for “The Loop”
Mobile Augmented Reality
Intel Corporation
18 FOR ALL KINDS OF PURPOSES July 22, 2012
19. Anatomy of a WordPress theme:
The Loop
Mobile Augmented Reality
Intel Corporation
19 FOR ALL KINDS OF PURPOSES July 22, 2012
20. Anatomy of a WordPress theme:
Additional Files
Mobile Augmented Reality
Intel Corporation
20 FOR ALL KINDS OF PURPOSES July 22, 2012
21. Anatomy of a WordPress theme:
The Extras
Mobile Augmented Reality
Intel Corporation
21 FOR ALL KINDS OF PURPOSES July 22, 2012
하드웨어가 제일 아래에 있고,그 위에 소프트웨어가 설치되어있는데,소프트웨어의 제일 아랫단에는 운영체제가 있습니다.여러종류의 운영체제가 있을 수 있지만, PHP는 Linux 운영체제에서 가장 좋은 성능을 보입니다.웹사이트를 운영하기 위해서는 Web Server 가 설치되어야 합니다. Web Server 는 Opensource인 Apache Web Server를 사용합니다.흔히 우리가 서버라고 말하면, 소프트웨어로 구현된 웹서버를 지칭하는 경우가 많습니다. 웹사이트의 데이터를 저장하기 위해 DB Server 도 설치되어 있어야 하는데,보통 MySQL 을 사용합니다.여기 보면 숫자가 써있는데, 이건 서버가 사용하는 포트번호입니다.하나의 물리적인 서버에서 수십 수백개의 서버를 운영할 수 있는 것은, 바로 이처럼 서로 다른 포트를 사용하기 때문에 가능한 것입니다.웹서버는 보통 80포트를 통해서 운영됩니다. PHP는 Apache Web Server 에 모듈 형태로 설치가 되는데, Apache Web Server는 원래 HTML만 처리할 수 있지만, PHP Parser가 설치 되면, PHP코드를 서버가 읽어서 HTML로 변환해줄수가 있게 됩니다. 따라서 Parser라는건 일종의 번역기라고 할 수 있겠습니다.