Table of Contents

  1. A short-hand reference of common Horde idioms to get things done.
    1. Classic UI: Reference an image from Theme
    2. Locations
      1. App Icon Url
      2. App Web Root Url
      3. App's Javascript Url
  2. Servicing JavaScript
    1. Load a file from app or horde base
    2. Forward backend variable data to js
    3. Default JavaScript Helpers

A short-hand reference of common Horde idioms to get things done.

Mostly useful to those who have recurring intermissions in their horde development.

Classic UI: Reference an image from Theme

Horde::img('image.png', 'Alt Text');
// The Image will be searched in the themes folders, precedence: current app, selected theme - current app, default theme - horde, current theme - horde, default theme

Locations

App Icon Url

$GLOBALS['registry']->get('icon', $app);

App Web Root Url

$GLOBALS['registry']->get('webroot', $app);

App's Javascript Url

$GLOBALS['registry']->applications[$app]['jsuri'];

Note: This is most likely not what you want. Use the template & js loading mechanism instead

Servicing JavaScript

Load a file from app or horde base

$page_output->addScriptFile('jquery-ui/jquery-1.9.0.min.js', $app);

Forward backend variable data to js

$page_output->addInlineJsVars($data);
This is useful for dynamic initialisation of Single Page Applications. Solves chicken - egg: Provide dynamic data the js needs to know but cannot (yet) get via ajax. Think of tokens or API Urls.

Default JavaScript Helpers

Date.CultureInfo - various locale settings from the backend.


Back to the Project List