HTML creation

From DAYDA Wiki
Jump to: navigation, search

Functions invoked by mouse-click generally do not echo output but write it to strings and submit it to the output() function. Thus, output redirection and placing it on a HTML page occurs outside the function.

Likewise, errors are not echoed but submitted to the err(), info(), verbose(), debug() (admin errors), and msg() (user messages) functions.

Javascript produced by a function is submitted to the script() function and data to be used outside the function are submitted as an array to the data() function.

The HTML class

A HTML document can first be created as node structure and then rebuilt as HTML code, using the (non-static) class HTMLBase and the static HTMLBase extension HTML. HTMLBase declares a standard instance of HTML, which is referred to as HTML::$inst. HTML instances can be (and should be) instantiated whenever a class or a function produces its own independent HTML code. HTMLBase is extensively documented in the built-in developer section of DAYDABASE.

The Activelink class

This Activelink class provides functions for the creation of HTML code used to build links and buttons that trigger predefined actions. The Activelink class is documented in the built-in developer section of DAYDABASE.

The Xfield() function

the Xfield() function is used to generate HTML code to display or allow modifying values.

Parameters: array(['table' => tablename, ] ['key' => field_id, ] ['object' => object_arr, ]

Returns: span element. If the user has permission to edit the field, an editable field opens on mouse click. If the user has view permission, the field is displayed, otherwise, an empty span is displayed.