Ning App Examples¶
Some of the tutorials and tutorial descriptions provided are based on the OpenSocial Tutorial for Orkut. Due to the open nature of OpenSocial, you may find that a lot of the Ning OpenSocial Applications that you create can easily be ported to other OpenSocial containers such as Orkut, hi5 and MySpace with very little additional development time, and vice versa.
OpenSocial Applications are essentially XML files that adhere to the OpenSocial specifications.
To create a quick “Hello World” application, paste the following code into the Google Gadget Editor, or an XML file.
You can view a live example of this on http://os.ning.com/apps/tutorials/hello-world.xml
From there, you can simply save your gadget as a file in your network (through WebDav) in a new directory, OpenSocial, with the name for example helloworld.xml. You can also can develop your XML document off an external server. Once you have done that, you can add your XML file to the profile page of your Ning Network. Detailed instructions on how to add your OpenSocial Application are listed later in this document: Testing Your Ning App.
Hello, Different Views!¶
<?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="Test app"> <Require feature="opensocial-0.8"/> </ModulePrefs> <Content type="html" view="canvas,profile"><![CDATA[ <p>Hello, world!</p> ]]></Content> <Content type="html" view="profile"><![CDATA[ <p>Hello, Profile View!</p> ]]></Content> <Content type="html" view="canvas"><![CDATA[ <p>Hello, Canvas View!</p> ]]></Content> </Module>
In the following example, “Hello, Profile View!” and “Hello, Canvas View!” is shown is the profile and canvas views, respectively. “Hello, world!” is displayed for the canvas and profile views.
As a way to reach out to the developer community as well as show examples of best practices of OpenSocial based applications that are used internally within Ning, we have made two of our Ning Apps, Twitter Tracker and Top Friends, available to the developer community under an Apache 2.0 License. The repositories are available in the following locations: