How to use includes on PhoneGap – An Introduction to PhoneGap Extensions

Nowadays developing multi-platform mobile applications is a big challenge for software engineer. The options basically are native applications, mobile paid engine platforms such as AppAcelerator and PhoneGap. Every approach has its advantages and problems and if you are reading this article you probably know that.

PhoneGap is a very nice platform. There you can really build multi platforms applications and its extensibility through plugins is amazing!!! On the other hand issues such as performance, how to create a really native experience remain. Software Engineers should provide solutions for these questions.

Another question in my opinion is how to reuse the HTML code. In my opinion to maintain code is a very serious problem when you consider using PhoneGap for serious business applications. Yeah you can use JavaScript and UI Frameworks such as Sencha Touch but you have to consider that use Java Script templates has performance costs and is created to solve other kind of problems.

So I how I could create an html5 file that reuse other file. That would be very useful and I didn’t find any open source solution to do that. That was the first reason to create this project.

After 3 days using my spare time I created an alpha version that just work on Android platform.

This is a simple example about how that works:

<script src="js/example.js"></script>
<phonegap:include file="includes/header.html"/>

this is a test file.


I really would like to find other developers to help me to translate the same idea for other platforms.

For use this functionality use the following steps.

1)Create a common android phonegap application. The steps to do that use:
2)Download the file attachement
3)After unzip the files include the java Files in your mobile application. This projects provides 4 additional classes: Command, ICommandExecutor, DroidGap and Preprocessor.
4)Change your app Activity. Instead of com.phonegap.DroidGap you should use com.phonegap.extensions.DroidGap

Last edited Jun 19, 2011 at 9:22 PM by kellyoliveira, version 3