Saving ... please wait
Access to [admin:bar] (with default [deny]) denied.
Intranet
Login >>
You are here: Home / Documentation / Writing a widget

Writing a new widget is easy! Just create a copy of one of the PHP files in xs/extensions/widgets and edit it to change the class name. Once it has been saved your new widget will automatically appear in the Widget Manager.

A widget is an extension that has an interface that users can interact with via the site. In xSiteable widgets usually appear as boxes of varying sizes, with a title bar.

Hello, World! example

There is a Hello, World example here:

xs/extensions/widgets/hello_world.widget.php

This widget simply outputs the text "Hello, World!", but it demonstrates the basics.

Widget Basics

Settings

These have default values but can also be set through the widget interface using the "gui" button.

Properties

These have default values but can also be set through the widget interface using the "options" button.

GET_content()

This is the function that returns the innermost content of the widget. If you want the widget with windows, frames and toolbars, use GET().

GET()

This function returns the whole widget, with frames, toolbars and content. If you want just the content, use GET_content().

More Advanced Stuff

Getting input from users

Saving data to the database

Saving data to the session

Tags

Access to [tags_controlled:edit] (with default [deny]) denied. Access to [admin:bar] (with default [deny]) denied.