Gadgets Without a GDK

Note: The below was written for the Plumtree 4.x portal. Since then, Plumtree released its 5.0 portal that makes the described approach optional but not necessary. In 5.0, Plumtree gateway transformation tags make all the below features available without regard to programming language in a much easier way.

Plumtree gadgets can display content from any system that can output HTML over HTTP. This is very open and nice. However, Plumtree only provides GDKs for ASP, ASP.NET, JSP, Perl, and ColdFusion (and these last two are not officially supported).

If you have a very simple gadget, one that has no real interactivity and displays only a single page, then you do not have any problems. You can register your code as a gadget, and display it in a MyPage or a Community Page. When your gadget is only slightly more sophisticated, however, you run into trouble if you don't have a GDK.

Let's say your gadget is written in PHP, and when it displays on the MyPage, it shows a list of links to other PHP files. Without a GDK, when you click on the links, you lose the portal's navigation scheme, colors, etc. Were the GDK available to you, you would have it send an HTTP header to the portal along with the page request that stated that you wanted to use hosted display mode. What do you do without the GDK?

Most programming languages let you insert extra HTTP headers. PHP is no different. If you simply put the following at the top of your PHP files, then if you send them through Plumtree's portal, you'll see the file in hosted display mode under Plumtree's banner:

    // use hosted display mode
    header("Csp-Display-Mode: Hosted");
Great, so now you have gotten your page to appear under Plumtree's banner. Let's take it a step further. You may want to access Plumtree settings such as the PT-Return-URI or the PT-User-ID. This information is sent from Plumtree to your PHP server. Simply ask for it:
    $systemSettings =$_ENV[HTTP_CSP_GATEWAY_SPECIFIC_CONFIG];
You now have in the string $systemSettings all the information that you would get through the GDKs dSystemSettings. You can install this example code on your PHP server to see this in action. Simply link to this file from a gadget on your Plumtree portal that specifies your PHP server in the Gateway URL Prefixes box of the Gadget Editor.

This example admittedly only gets you started. It does not show you how to access any portal settings or how to set those settings. Read Plumtree's The Gadget Book to understand the CSP and these settings. You can then get started with tcpTrace to modify this PHP code to have PHP gadgets that are equally interactive as those written in a language that has a supported GDK.


 
HomeResume | Contact Information