Post on 01-Nov-2014
description
Drupal + iPhone = AWESOME
Eneko Alonsoealonso@level-studios.com
Silicon Valley Code CampOctober 2009
Eneko AlonsoI am a Software Engineer and UI Developer,
currently working at Level Studiosealonso@level-studios.comwww.level-studios.comwww.enekoalonso.com
Eneko Alonsoealonso@level-studios.com
DRUPAL
Eneko Alonsoealonso@level-studios.com
Drupal: what is it?
• Content Management System• Community (user management, roles,
permissions)• Base for great web applications
Check out www.drupal.org
Eneko Alonsoealonso@level-studios.com
iPhone
Eneko Alonsoealonso@level-studios.com
iPhone: what is it?
Eneko Alonsoealonso@level-studios.com
Drupal + iPhoneWhy?
Eneko Alonsoealonso@level-studios.com
Drupal+iPhone: why?
Let your users access your site on the goBut also, great for administration
Eneko Alonsoealonso@level-studios.com
Setup: what do we need?
Eneko Alonsoealonso@level-studios.com
Drupal: what we need
Drupal site:• [X]AMP Server (PHP, Apache, MYSQL)• Drupal distribution (6.14 in this demo)
JSON API:• Services Module• JSON Server Module
Eneko Alonsoealonso@level-studios.com
iPhone: what we need
1. XCode with iPhone SDK (3.0 on this demo)2. TouchJSON library
http://developer.apple.com/iphone/http://code.google.com/p/touchcode/wiki/TouchJSON
Eneko Alonsoealonso@level-studios.com
iPhone: what we don’t need
1. iPhone Developer License*
* Needed only to put your app in your iPhone for testing.
http://developer.apple.com/iphone/http://code.google.com/p/touchcode/wiki/TouchJSON
Eneko Alonsoealonso@level-studios.com
Setup
Eneko Alonsoealonso@level-studios.com
Create a user account on the site:http://[server_ip]/user/register
Write a new story:http://[server_ip]/node/add/story
On XCode 3.1, create a new iPhone project
Eneko Alonsoealonso@level-studios.com
Demo Setup
Drupal Setup
1. Create DB: CREATE DATABASE drupal_iphone_demo;
2. Download drupal: wget http://drupal.org/…
3. Install drupal (browse to your server url)4. Install and enable modules (Services)5. Configure user permissions
Eneko Alonsoealonso@level-studios.com
iPhone Setup
1. Create new Project2. Add JSON library to project (TouchJSON)3. Add a button to the view4. Add a method for system.connect5. Execute server request and show data on
console
Eneko Alonsoealonso@level-studios.com
API Calls
Eneko Alonsoealonso@level-studios.com
system.connect
Initiates user sessionServer returns valid sessionId for login
Eneko Alonsoealonso@level-studios.com
user.login
Logs user into DrupalSame user permissions as on the site
Eneko Alonsoealonso@level-studios.com
node.get
Retrieves a full node from the server
Eneko Alonsoealonso@level-studios.com
node.save
Saves changes or creates a new node
Eneko Alonsoealonso@level-studios.com
views.get
Collection of nodes (great for table views)
Eneko Alonsoealonso@level-studios.com
Creating custom services
Eneko Alonsoealonso@level-studios.com
myservice.hello
Let’s create a ‘Hello world’ service
Eneko Alonsoealonso@level-studios.com