Close
Next
Prev

 

    Loading...

Loading Pluck Applications

Calling an application from the Pluck Application Server—apart from using REST or the Pluck SDKs—can be done in two ways: through a JavaScript call, or with an XHTML tag (<PAS>). The preferred method is to use the JavaScript call. It's generally faster, and it gives you a few more optional parameters that control the display of the app.

JavaScript Call

To use the JavaScript Call, you must:

  1. Load the Pluck Libraries on the page. Give your site access to the applications on the Pluck Application Server by including the following somewhere in the <head> tag:

    <script type="text/javascript" src="http://yourdomain.com/ver1.0/Content/ua/scripts/pluckApps.js"></script>
  2. Place the JavaScript call on the page where you want the app to appear:
    <script type="text/javascript">
    	pluckAppProxy.embedApp("pluck/forums");
    </script>
    

The JavaScript Call takes a number of app parameters specific to each application. For example, for Forums, plckForumPage, plckForumWidgetHeader, and plckForumPostItemsPerPage are some of the parameters that specify what displays in the Forums app.

Additionally, the JavaScript call also takes options that specify how the app embedding is handled. These options are valid for any Pluck JavaScript call:

A sample call including the global options might look like this:


<script type="text/javascript">
	pluckAppProxy.embedApp("pluck/forums", {
		plckForumPage: "ForumCategories",
		plckCategoryItemsPerPage: "5",
		},
		{
			elem: "DIV", //adds a wrapper element around the app from anything in the DOM
			pendingClass: "pendingMonkeyDishwasher", //adds a class to the wrapper element while the app is loading
			completeClass: "purpleMonkeyDishwasher", //adds a class to the wrapper element after the app is loaded
			forceDelayTimeout: 5000 //specifies a time to delay display of the app. In milliseconds.
		});
</script>


This is the preferred way to call apps from the Pluck Application Server, but in some circumstances you may need to use the older way with <PAS> tags.

PAS Tags

To use PAS tags, you must:

  1. Set the XML Namespace. In the <HTML> tag on each page you’re installing the Pluck app, set the XML namespace for Pluck’s Social Application Server:

    
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:pas="http://www.yourdomain.com/2009/pluckApplicationServer">
  2. Load the Pluck Libraries. Give your site access to the applications on the Pluck Application Server by including the following somewhere in the <head> tag:

    <script type="text/javascript" src="http://yourdomain.com/ver1.0/Content/ua/scripts/pluckApps.js"></script>
  3. Add the Pluck application to the page. Pluck applications can be placed on the page using specially namespaced tags (That’s why we set the XML namespace in the <HTML> tag). The XHTML tags look like:

     <pas:pluck_appname parameters></pas:pluck_appname>

    where appname specifies the Pluck app you’re calling (forums, persona, comments, etc.) and parameters are the app specific parameters for that app.

    For example if you want to place the Pluck Comments application it might look like this:

    <pas:pluck_comments plckCommentOnKeyType="article" plckCommentOnKey="12345"></pas:pluck_comments>

    where plckCommentOnKeyType specifies what kind of content the comments belong to—In this case, they belong to an article— and plckCommentOnKey is the unique number identifying the parent content. This allows the Pluck Application Server to return the correct set of comments.

Note:

Be sure to use open tags and close tags for the pas tags. The page may have problems rendering if you use self-closing tags (i.e., <pas:pluck_comments />). Instead, use the full tag name (include the colon and attribute after it) in both the open and close tag, like this: <pas:pluck_comments></pas:pluck_comments>

Note:

ExternalResource (Article) keys uniquely identify the parent of a comment stream, reviews, recommendations, or other reactions throughout its lifetime and can not be changed. If your CMS changes the ID of an article, product, or other item you’ve placed a Pluck reaction on, you must create a mapping between the Pluck ExternalResource key and your new ID value.

    6.0.11 Release        © 2014 DemandMedia                                   Teacher’s Edition