[Skip Header and Navigation] [Jump to Main Content]
Home
oncode.info
Coding is a craft...

Languages

  • English
  • Deutsch

Primary Links

  • Home
  • About us
  • Contact
  • Blog

Search

  • Moodle
    • Resource-Block
    • UWA-Block
    • Distractor-Block
  • Tools
    • PHP-SEO-Tools
    • PsycoXPath
    • PHP-UWA-Library
    • Hide-Email
    • PHP-Zip

PHP UWA Library

Submitted by skaldrom on Sun, 01/09/2011 - 10:40
  • Tools

This library helps using UWA-Widgets from Netvibes on your PHP-page. It uses the now-recommended IFrame method.

Features

  • Custom configuration menu
  • Dynamic height resizing
  • Simple API
  • Configurable header

Usage

Basic usage

  1. Copy uwawidget.php somwhere you can include it from your application.
  2. Copy proxy.html somewhere in the web-accessible part of the server. This file manages the communication between the widget and your page.
  3. In your code, require_once the uwawidget.php file.
  4. To create a new uwawidget-object in your code, you need at least the following information:
    • The URL of the widget: You can get it from the UWA Ecosystems page by clicking on Source of the desired widget on the widget-page of the widget-library.
    • The Web-Url of the proxy.html file.
  5. Create the uwawidget-object: $uwawidget = new uwawidget($widgetURL, proxyHtmlUrl);.
  6. Print the needed HTML on your page and you are done: echo $uwawidget->getHtml();.

Custom configuration menu

You can hide the widget-header with the edit-menu if you provide false as thirth parameter of the uwawidget-constructor. You need to provide your own configuration form in this case. You get an array of label/input-html pairs if you call $uwawidget->getPreferencesHtml(). There are two top-arrays: visible for fields you should display as input-fields and hidden for hidden form fields. See example.php for the detailed usage.

If the configuration form is submitted, you can call the uwawidget with the submitted data: $uwawidget->setAndValidatePreferencesData($_POST['uwawidgetdata']). getHtml() automatically submits these values to the widget.

Troubleshooting

Data entered into the widgets is not shown if the page is reloaded.

If the authetication in a widget is not handled by cookies or a login, there is not much that can be done. It looks like the netvibes dashboard handles the saved datasets and provides these to the widget. No dashboard, no saved data, just default-values.

Helper functions

getMetaData() returns all meta data known for the widget, getMetaDataHtml() prints this information nicely for debugging purposes.

Further Help

See a demo on oncode.info. The Library is used in the Moodle UWA Widget Block.

Downloads

  • View all releasesRSS feed of all releases

Resources

  • Read license
  • Try out a demonstration
  • Look at screenshots

  • Deutsch
All content is © 2010, 2011 by oncode.info. Keep doing something.
[Jump to Top] [Jump to Main Content]