views:

49

answers:

2

I'm not really a server-side person – I generally do iPhone apps, though I've hacked together a few Wordpress sites.

I'm curious as to what web technologies people would use for the back-end of an iPhone app whose front end presents as a basic forum. In other words, people can create new threads, and respond to them - with plain text only.

The forum would not exist as a website.. the only way to access it would be on the phone.

What technology would people recommend I use? Ruby-on-Rails with Amazon S3 storage? Could I even use existing forum software and pass and receive data to and from it? Perhaps even a forum Wordpress plug-in? Or is there a better way?

+1  A: 

If you wanted to, you could use existing forum software and/or Wordpress to facilitate what you want, which would be easier than building your own forum from scratch. You could, with that existing framework, set up your own little API to communicate from the iPhone app to the server- for example, send a $_GET request to a PHP script on your server, which would return a list of forum topics. You could have similar PHP scripts that could do similiar functions, like adding a post or deleting topics.

That's pretty much how I've got it set up on an iPhone app I recently made- my server has a basic forum system, and I just wrote a couple of PHP scripts to return information from a MySQL server. However, if you'd particularly prefer to use Wordpress/Amazon S3/whatever else, then I could give more specific instructions relating to those services.

*EDIT*

Here's an example PHP script you could use (after you've created databases):

forumcategories.php

<?php
// insert database connecting logic here

$query = mysql_query("SELECT * from categories");

echo "<categories">;

while($row=mysql_fetch_array($query)){
echo "<category><id>" . $row['id'] . "</id><title>" . $row['title']; . "</title></category>;"

}
echo "</categories>";

?>

This is a really simple script- of course, you would need to add in code to connect to the database (which can be found easily online) and probably some error checking, but other than that, it will do the trick. What you would do in the iPhone app is send a request to http://yourserver/forumcategories.php and it would return XML listing all of the categories, which can easily be parsed with NSXMLParser and placed into a UITableView, for example.

Chromium
Thanks - what was the basic forum system you used? Was it off the shelf, or custom? Would love to know more about possible Wordpress solutions.
cannyboy
Well, I made my own simple forum by making MySQL tables and writing PHP scripts to return/add/edit information in them- I didn't bother to build a web interface, as I knew it would be used for an iPhone app. However, if you'd prefer a simpler way, Wordpress might be the way to go. There definitely are Wordpress forum plugins out there... but I'm currently searching for one now that would be able to communicate with $_POST or $_GET requests from an iPhone app.
Chromium
Of course, this is all assuming that you would be more comfortable with PHP and/or other web languages... if you'd rather skip the server-side scripting and communicate directly with Objective-C from the app to your database, you could. However, I wouldn't recommend that method as such things can get pretty complicated and confusing.
Chromium
I'm not too comfortable with PHP/MySQL, but I guess I need to start somewhere. Perhaps I could adapt something like this: http://www.phpeasystep.com/workshopview.php?id=12
cannyboy
Yeah- in fact, it would be easier than that, because you would only need to do the part of creating the databases, as you would skip all the PHP/HTML to displaying it to a page. Then, you could make a PHP scripts to return/edit/remove forum information.
Chromium
As you can see, I've modified my post to show an example script.
Chromium
Great, thanks, I'll have a look at that. Looks like I might be able to pull it off, even with my basic knowledge.
cannyboy
PS I thought this was interesting, though too terse for my needs - http://www.nerdparadise.com/blogs/blake/6034/
cannyboy
+1  A: 

Google App Engine is very good for what you describe. There are a lot of advantages to this approach: choice between Java and Python, access to the Google Accounts API, persistence/datastore APIs,... and you don't have to setup much to start working.

I also recommend that your server app returns responses formatted according to Apple's XML Property List format, instead of any other XML or JSON format. You can avoid NSXMLParser (or any other parser) altogether and save time to use on other important stuff.

Nick Toumpelis
I'm not familiar at all with the Google App Engine - are there any existing setups which approximate my needs? XML - yes, I've heard plists are quicker to parse on the iPhone. However, there's a possibility that there may be Android versions, so XML looks like the best option. I'm reasonable familiar with NSXMLParser too.
cannyboy
I don't know if there is anything that you can use out of the box for your needs. However, it is very easy to get started and develop a reasonable application will moderate effort.
Nick Toumpelis