PHP and Rich Internet Applications Mike Potter - - PowerPoint PPT Presentation

php and rich internet applications
SMART_READER_LITE
LIVE PREVIEW

PHP and Rich Internet Applications Mike Potter - - PowerPoint PPT Presentation

PHP and Rich Internet Applications Mike Potter http://www.riapedia.com/ mike.potter@adobe.com Fast Easy <?php if (!$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) { echo 'Could not connect to mysql';


slide-1
SLIDE 1

PHP and Rich Internet Applications

Mike Potter http://www.riapedia.com/ mike.potter@adobe.com

slide-2
SLIDE 2

Fast Easy

slide-3
SLIDE 3

<?php if (!$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) { echo 'Could not connect to mysql'; exit; } if (!mysql_select_db('mysql_dbname', $link)) { echo 'Could not select database'; exit; } $sql = 'SELECT foo FROM bar WHERE id = 42'; $result = mysql_query($sql, $link); if (!$result) { echo "DB Error, could not query the database\n"; echo 'MySQL Error: ' . mysql_error(); exit; } mysql_free_result($result); return($result); ?>

slide-4
SLIDE 4 function PMA_getSearchSqls($table, $search_str, $search_option) { global $err_url, $charset_connection; // Statement types $sqlstr_select = 'SELECT'; $sqlstr_delete = 'DELETE'; // Fields to select $res = PMA_DBI_query('SHOW ' . (PMA_MYSQL_INT_VERSION >= 40100 ? 'FULL ' : '') . 'FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($GLOBALS['db']) . ';'); while ($current = PMA_DBI_fetch_assoc($res)) { if (PMA_MYSQL_INT_VERSION >= 40100) { list($current['Charset']) = explode('_', $current['Collation']); } $current['Field'] = PMA_backquote($current['Field']); $tblfields[] = $current; } // while PMA_DBI_free_result($res); unset($current, $res); $tblfields_cnt = count($tblfields); // Table to use $sqlstr_from = ' FROM ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($table); // Beginning of WHERE clause $sqlstr_where = ' WHERE'; $search_words = (($search_option > 2) ? array($search_str) : explode(' ', $search_str)); $search_wds_cnt = count($search_words); $like_or_regex = (($search_option == 4) ? 'REGEXP' : 'LIKE'); $automatic_wildcard = (($search_option <3) ? '%' : ''); for ($i = 0; $i < $search_wds_cnt; $i++) { // Eliminates empty values // In MySQL 4.1, if a field has no collation we get NULL in Charset // but in MySQL 5.0.x we get '' if (!empty($search_words[$i])) { for ($j = 0; $j < $tblfields_cnt; $j++) { if (PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL' && $tblfields[$j]['Charset'] != '') { $prefix = 'CONVERT(_utf8 '; $suffix = ' USING ' . $tblfields[$j]['Charset'] . ') COLLATE ' . $tblfields[$j]['Collation']; } else { $prefix = $suffix = ''; } $thefieldlikevalue[] = $tblfields[$j]['Field'] . ' ' . $like_or_regex . ' '
slide-5
SLIDE 5
slide-6
SLIDE 6

www.riapedia.com

slide-7
SLIDE 7
slide-8
SLIDE 8

RIA Characteristics

  • Full applications
  • Could replace desktop apps
  • Applications, not web pages
slide-9
SLIDE 9
slide-10
SLIDE 10
slide-11
SLIDE 11

What’s in it for me? for my employer?

slide-12
SLIDE 12

Rich Internet Applications are the next evolution of the web.

“ ”

Source: Gartner Research, May 11, 2005
slide-13
SLIDE 13

Builds on existing skills and knowledge

slide-14
SLIDE 14

$

slide-15
SLIDE 15

Saved ~160 GB in 3 hrs

slide-16
SLIDE 16

User experience matters

slide-17
SLIDE 17

Client Options

  • Ajax (In Browser)
  • Java (Sun)
  • XUL (Mozilla)
  • XAML (Microsoft)
  • MXML (Adobe Flex)
slide-18
SLIDE 18

Ajax Examples

slide-19
SLIDE 19

XUL Examples

slide-20
SLIDE 20

XUL Examples

Songbird

slide-21
SLIDE 21

XAML Examples

slide-22
SLIDE 22
slide-23
SLIDE 23
slide-24
SLIDE 24
slide-25
SLIDE 25
slide-26
SLIDE 26

To Think About

  • Reach - How many people will view this

application? What platform will they be on? Is it an open or closed platform?

  • Rich - Can I integrate rich content easily,

like video, audio and animations?

  • Tools - What will I use to build this

application? How will I debug?

slide-27
SLIDE 27

PHP and RIAs

  • Read in XML from a PHP backend (REST)
slide-28
SLIDE 28

REST with PHP

<?php //connect to the database mysql_connect ... //get the data mysql_query( “SELECT * from recipes”); ... //transform into XML print “<recipes><recipe id=’1’ name=’cake’/><recipe id=’2’ name=’hotdog’/></recipes>”; ?>

slide-29
SLIDE 29
slide-30
SLIDE 30
slide-31
SLIDE 31

PHP and RIAs

  • Transfer PHP objects to the client directly
  • JSON - JavaScript Object Notation
  • AMF - ActionScript Messaging Format
slide-32
SLIDE 32

JSON and PHP

slide-33
SLIDE 33
slide-34
SLIDE 34
slide-35
SLIDE 35
slide-36
SLIDE 36
slide-37
SLIDE 37

Flex with AMFPHP

<?php //connect to the database mysql_connect ... //get the data $ResultObject = mysql_query( “SELECT * from recipes”); ... return( mysql_fetch_object( $ResultObject ) ); ?>

slide-38
SLIDE 38

How to make money?

slide-39
SLIDE 39

How to make money?

slide-40
SLIDE 40

Recap

  • Build PHP apps as services that can be used

by any front end - Ajax, XAML, Flex etc...

  • Rich clients and components allow you to

simplify your PHP code

slide-41
SLIDE 41

What’s next?

slide-42
SLIDE 42

Web Compiler for Flex Applications

  • http://labs.adobe.com
  • Allows you to create MXML, ActionScript,

upload to the server and compile there, similar to developing PHP applications

slide-43
SLIDE 43
slide-44
SLIDE 44
  • Offline / Occasionally Connected
  • Applications can run in background
  • Network
  • HTTP
  • XML-RPC / SOAP / Rest based web services
  • Binary and XML sockets
  • File I/O
  • Local storage / Settings API
  • Custom Chrome
  • Shape
  • Alpha

Apollo enables...

slide-45
SLIDE 45
slide-46
SLIDE 46
slide-47
SLIDE 47

THANK YOU!