6.0.0-git
2024-04-19

Diff for Doc/Dev/CheatSheet between 5 and 6

[[toc]]

+ 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.


----
Back to the ((Project|Project List))