How to Add a Twitter Feed Gadget to Your Website
eXo Platform 3 provides many features for building rich websites out of the box. But you can also use the platform's web-based IDE to build custom plug-ins or gadgets that add an almost limitless number of capabilities. We wrote a simple gadget that displays a Twitter feed of all the recent company-related tweets, which is an easy way to display fresh content on a site's homepage. This tutorial will guide you through the process of creating the Twitter gadget and adding it to a website page.
To be able to complete this how-to, you will need a recent version of eXo Platform, preferably 3.0.3 or later, up and running. You can download a 30-day trial from our website homepage.
Step 1: Generating the Widget
To integrate the standard Twitter gadget, first go to the Twitter widget page. Fill in the search query for the type of feed you want to display (in our case, we want to display any tweets from our company account or our CEO, so we entered "@exoplatform or @benjmestrallet"). In the dimensions menu, change the width to 215. Click on "Finish and Grab Code". Copy the code.
Step 2: Creating the Gadget
Go to the eXo Platform portal and login to the sample ACME website as the user John. In the "My Spaces" drop-down menu, go to the IDE; from here click on "create a gadget". Specify a name for your gadget, and set the height to 410. In the CData tag, paste the widget code provided by Twitter.
Our code looks like this:
If you want to see your gadget working from within the IDE, click on "Run" > "Show preview" in the menu. To finish, go to the "Run" menu and click on "Deploy gadget to GateIn".
Step 3: Adding the Gadget to the Application Registry
Before you are able to insert the gadget in a page, you need to make it available to webmasters by adding it to a category in the application registry.
Step 4: Inserting the Widget in Your Homepage
Now you are done with the configuration, so you can insert the new Twitter widget on the Acme homepage. On the homepage, from the "Site Editor" menu, select "Edit page". In the editor, you simply drag and drop the gadget to the page. If you don't want to have all the portlet frame decoration surrounding the Twitter widget, you can click on the edit button and uncheck "Show Info Bar", "Show Portlet Mode" and "Show Window State", then save.
In only 4 simple steps, you should now have a custom Twitter feed integrated in your homepage. You can also quickly integrate any kind of widget into your portal following this process.