Developing Apps
From Xenon
Contents |
Languages
Apps must be developed in any combination of (X)HTML, CSS, Javascript, PHP and MySQL. The servers may be able to have a different language, ask for details.
Apps for the desktop (e.g. sync, installer) can be programmed in any GUI language, so long as it can run natively (easily ported) on any operating system (eg Python, C#)
Apps
To create an app, follow these steps:
Conventions
E.g. [shortname] = "audio", [appname] = "Audio Player"
Instructions
1. If it's an official app, make a file called apps/[category]/[shortname]/app.php. If it's an app store app, the path is appstore/[category]/[shortname]/app.php
2. Add to it a <div id="[shortname]" class="[appsize]"></div>
Where [appsize] is one of app_large, app_small, app_tiny.
Large apps span the whole screen, 1000x600, and get shrunk to 750x600 when a small app is started. Small apps are 250x600. Tiny apps are 1000x25, to go along the top. An example would be the audio player's control.
If you wish to reference a file, do not do it relative to apps/[category]/[shortname]/app.php. do it relative to the root directory (where login.php is located).
E.g. To access user/robert/background.php use "../user/robert/background.php".
AJAX calls
Inside of your DIV you put HTML code. Never refresh the page or go to a new one. If you need active content you can add an AJAX call, one of:
doAjax('apps/[category]/[shortname]/phpfile.php','theId'); // replaces theId.innerHTML with the output from PHP
doAjaxFunc('apps/[category]/[shortname]/phpfile.php','theFunction();'); // executes theFunction when the AJAX is done
return doAjaxSynchronous('apps/[category]/[shortname]/phpfile.php'); // returns the value which phpfile.php echoes
Ajax PHP files must have :
include '../../../dbprivate.php'; // for private access to user's DB, such as user's files
include '../../../dbpublic.php'; // for public acccess to public DB, such as for blogging
at the top.
If they reference other files, reference them relative to the ajax file.
When you've finished
Please email a compressed folder of these files to dan.dart@googlemail.com for review.
Other things
If you'd like to add a database table, simply execute mysql_query("CREATE TABLE IF NOT EXISTS....") at the top of your app.
We are currently making functions to facilitate easy DB and file management. So if you would like to use something that uses them, you could of course help us along.
Things to discuss
- Session variables or GETs from each app?
- How to encourage people to develop?
