Advanced Configuration and Using xmlConfig

From developer.newsgator.com

Jump to: navigation, search

Contents

Overview

The Advanced Configuration utility allows you to store simple Key/Value pairs that are available for use within your widget. It can be used to replace an XML config file that you would reference in your widget.

These values are available in XML format for you to use within your widget however you feel necessary.

How to Set it Up

In Editor's Desk, click on the Advanced Configuration utility for your widget.

Image:Config.jpg

Specify key/value pairs in the boxes provided, and click the "add" symbol to save them.

Accessing the Config Data

Flash widgets

In a Flash widget, accessing the config data can be done via a GET request to the following URL. You will need to update the [BUZZID] and [APITOKEN] values with those of your widget.

http://nmp.newsgator.com/ngbuzz/buzz.ashx?buzzId=[BUZZID]&apiToken=[APITOKEN]&load=xmlConfig

This will return a block of XML that will include your configuration settings, much like the following:

- <widget>
	<name>Master</name> 
	- <configuration>
	  <border-color>blue</border-color> 
	  <width>300</width> 
	  </configuration>
	+ <kvpairs>
</widget>

HTML widgets

In your HTML widgets, you can access the value for each key directly, using either of the following:

${BuzzObj.WidgetConfiguration.myKeyName} 

  OR 

${BuzzObj.WidgetConfiguration["myKeyName"]}

Advanced Configuration settings are also a handy way to test widgets that make heavy use of ExtraArgs. If you initialize variables from either ExtraArgs or WidgetConfiguration you will be able to more easily test and preview your widget within Editor's Desk or The Wringer.

For example, the following will accept a setting from ExtraArgs, but default to WidgetConfiguration if the setting is not specified in ExtraArgs.

{var teamName = ExtraArgs.teamName || WidgetConfiguration.teamName}

Naming Restrictions

There are a couple of restrictions regarding the naming of your Keys:

  • key names may not begin with "sharing_"
  • key names may not contain spaces
  • key names may not start with a number
  • key names may only consist of letters, numbers, periods, hyphens, underscores, and colons
  • key names must be unique for the widget (e.g., you may not define the same key name more than once for a single widget)
Personal tools