Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

20120722 word press

  • Be the first to comment

  • Be the first to like this

20120722 word press

  1. 1. Programming Backgroundfor WordPress Barnabas Kim Mobile Augmented Reality July 22, 2012 REV 3: WW22 | 2011FOR ALL KINDS OF PURPOSES
  2. 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 Corporation2 FOR ALL KINDS OF PURPOSES July 22, 2012
  3. 3. Topic #1: Preliminaries3 FOR ALL KINDS OF PURPOSES Intel Corporation
  4. 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 Corporation4 FOR ALL KINDS OF PURPOSES July 22, 2012
  5. 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 Corporation5 FOR ALL KINDS OF PURPOSES July 22, 2012
  6. 6. Topic #2: PHP Tutorial for WordPress6 FOR ALL KINDS OF PURPOSES Intel Corporation
  7. 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 Corporation7 FOR ALL KINDS OF PURPOSES July 22, 2012
  8. 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 Corporation8 FOR ALL KINDS OF PURPOSES July 22, 2012
  9. 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 Corporation9 FOR ALL KINDS OF PURPOSES July 22, 2012
  10. 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 Corporation10 FOR ALL KINDS OF PURPOSES July 22, 2012
  11. 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 Corporation11 FOR ALL KINDS OF PURPOSES July 22, 2012
  12. 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 Corporation12 FOR ALL KINDS OF PURPOSES July 22, 2012
  13. 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 Corporation13 FOR ALL KINDS OF PURPOSES July 22, 2012
  14. 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 Corporation14 FOR ALL KINDS OF PURPOSES July 22, 2012
  15. 15. Topic #3: Anatomy Of A WordPress Theme15 FOR ALL KINDS OF PURPOSES Intel Corporation
  16. 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 Corporation16 FOR ALL KINDS OF PURPOSES July 22, 2012
  17. 17. Anatomy of a WordPress theme: Main Parts Mobile Augmented Reality Intel Corporation17 FOR ALL KINDS OF PURPOSES July 22, 2012
  18. 18. Anatomy of a WordPress theme: Sections for “The Loop” Mobile Augmented Reality Intel Corporation18 FOR ALL KINDS OF PURPOSES July 22, 2012
  19. 19. Anatomy of a WordPress theme: The Loop Mobile Augmented Reality Intel Corporation19 FOR ALL KINDS OF PURPOSES July 22, 2012
  20. 20. Anatomy of a WordPress theme: Additional Files Mobile Augmented Reality Intel Corporation20 FOR ALL KINDS OF PURPOSES July 22, 2012
  21. 21. Anatomy of a WordPress theme: The Extras Mobile Augmented Reality Intel Corporation21 FOR ALL KINDS OF PURPOSES July 22, 2012
  22. 22. Thank you for your attention! any Question?

×