Dotclear

templateWidget

Define widgets using template file only

Author/Contributors?

  • Author: Oaz
  • Contributors:

Development

Bugs and features requests

Repository

Recent Changes

[3191] by brol on 09/20/13 15:38:29

version 1.4.4 : ajout localisation + tpl taglist.widget.html + changement emplacement widget et pétouilles

[3187] by brol on 09/19/13 19:52:56

version 1.4.3 : compatibilité dc2.6, page valide

[3147] by brol on 08/01/13 01:30:24

version 1.4.2

Documentation

templateWidget is a plugin that adds "html based" widgets to dotclear

General use

After install, go to the Template Widget page in blog administration. There you can activate/deactivate the ".widget.html" files found in the system. Each one of them defines a widget.

The ".widget.html" can be installed in the usual places for dotclear templates : 'tpl' folder of a theme, 'default-templates' of the plugin.

After a widget is activated in the plugin admin page, it is available in the widget admin page of the blog.

Example of widget definition file

Each widget is defined by a ".widget.html" file. It is an html file using the dotclear template syntax.

Here is a minimalist example of such a file :

<tpl:WidgetName>Mini</tpl:WidgetName>
Bonjour {{tpl:WidgetText name="nom" title="Entrez votre nom :" default="visiteur"}} !<br/>
Vous &ecirc;tes sur le blog {{tpl:BlogName}}.<br/>

The <tpl:WidgetName> tag defines the widget name appearing in the widgets admin page. The {tpl:WidgetText} defines a text parameter for this widget. The text content will be inserted in the html when the widget is displayed.

Full syntax for widget definition files

The following templates define the widget parameters :

  • {tpl:WidgetText} : text (by default) or textarea (adding type="textarea") parameter.
  • <tpl:WidgetCheckboxIf> : checkbox parameter. The "value" attribute defines if the block content is displayed (value="1") or not (value="0")
  • <tpl:WidgetComboIf> : combo parameter providing a list of options. The behavior is similar to <tpl:WidgetCheckboxIf>. The "options" attribute defines the list of available options (separated by ":").

Beyond specific attributes, each parameter tag accepts the following attributes :

  • name (mandatory) : parameter name
  • title (mandatory) : text displayed beside the parameter in the widget admin
  • default (optional) : initial value
  • order (optional) : parameter order in the widget admin

This plugins also provides miscellaneous tags to defines widgets :

  • <tpl:WidgetDefineBlock> : defines a reusable html block. The "name" attribute identifies the block.
  • {tpl:WidgetUseBlock} : insert the content of a reusable html block. The "name" attribute identifies the block.
  • <tpl:WidgetPageTypeIf> : display the content of the tag according to a page type (defined by the "type" attribute). This tag allows to limit the widget display to some kind of page (home page for example).

Most of these tags are demonstrated in the widget definitions delivered with the plugin (in the 'default-templates' folder).

Attachments

Sites map