Skip to content

Latest commit

 

History

History
1466 lines (1036 loc) · 68.6 KB

php2html.api.md

File metadata and controls

1466 lines (1036 loc) · 68.6 KB

php2html 1.9.2 - API reference

Generated by tools/make_api_md.php from the parameter comments in php2html.lib.php - do not edit by hand, run the tool again. Written for people and AI coding assistants: read this file instead of the 500 KB library.

Conventions

  • One file: require_once 'php2html.lib.php'; - no build step, no package manager. PHP 8.1+.
  • Call with named arguments - always: htm_Card_(capt:'@Settings', icon:'fas fa-sliders', clas:'cardW800');. The order of the parameters has changed between versions (1.7); names are stable. An unknown name is a fatal error.
  • Parameter names are 4 characters from a fixed vocabulary: labl label, capt caption, hint tooltip, icon Font Awesome class, name field name, valu value, form form id, acti action, wdth width, vhgh max height, styl style, attr attributes, clas CSS class, kind colour / purpose, vrnt variant, list options, plho placeholder, rtrn return instead of echo.
  • Output: most htm_* functions echo their HTML. With rtrn:true they return it as a string instead. Functions without rtrn always echo (see the table).
  • Texts are translated: a text that starts with @ is a translation key - '@Save' is shown via lang() in the language of the session (translations in _trans.sys.json). Texts without @ are shown as they are. The language: the one chosen in htm_LangSelect() ($_SESSION['p2h_lang']), else $lang set by the page before the require ($lang= 'da';), else English. ($_SESSION['proglang'] is not used for the translations.)
  • Pairs: htm_Page_ ... htm_Page_end, htm_Card_ ... htm_Card_end, htm_Form_ ... htm_Form_end, htm_Tabs_ / htm_Tab ... htm_Tabs_end, htm_RowCol_ / htm_RowCol_next ... htm_RowCol_end, htm_List_ / htm_List_item ... htm_List_end. Always close what you open.
  • Session: the library starts the session (httponly, SameSite=Lax, secure on HTTPS) unless the page has started it already.
  • Forms and CSRF: htm_Card_(form:'f_x') wraps the card body in a POST form with the CSRF token. In your own forms echo csrf_field(). Every POST is checked when the library is included: a missing or wrong token stops the request (HTTP 403, CSRF-validating failed) before your code runs - so the page needs no csrf_verify() of its own (calling it again does no harm).
  • POST from JavaScript: p2hPost(url, {id: 7}).then(r => r.json()) (every page of htm_Page_ has it) sends the CSRF token along. A plain fetch() POST without the token gets 403.
  • Log in: htm_Login() shows the form; sys_login(hash:$hash, pass:$_POST['p2h_pass']) checks it (a growing wait after wrong tries, for all browsers together) and returns '' when it is right; sys_loginUser() is '' when nobody is logged in; sys_logout(). Logins, failed and blocked tries and log-outs go to the activity log when p2h_audit.inc.php is included. A page behind the login: if (!sys_loginRequired(link:'login.php')) exit; - after the login sys_redirect('', link: sys_loginBack('/')) returns to that page. htm_Login(list:[...]) lets the user choose what to log in to (posted as p2h_list) - check on the server that the user may open it.
  • Quotes: ' for PHP strings, " for HTML attributes.

Pitfalls

  • Several actions in one form: give each htm_AcceptButt its own valu: (valu:'save', valu:'delete') and read $_POST['act'] (another name with name:). Without valu and acti the button gets onclick='location.reload();' - the form is still posted, but the button posts no value of its own.
  • After a POST answer with sys_redirect('@Saved') - not with HTML: the page is loaded again with GET (a reload does not post again) and htm_Page_ shows the message once (htm_Flash). An error: sys_redirect('@Not saved', 'error').
  • The library version is the constant P2H_VERSION. Since 1.8.2 the library leaves the page's own $DocVer, $DocRev, $DocFil and $© alone (1.8.1 and older overwrote them when included).
  • No nested forms: a card with form: must not be inside another card with form:.
  • A script that must accept a POST without a token (a webhook, a JSON API, a callback from another site) must not include the library - it would answer 403. Put such endpoints in their own file.
  • Global settings are $gbl_* variables (colours, card moving, flags, the program root) - set them before the require.

A minimal page

<?php
require_once __DIR__.'/php2html.lib.php';     // starts the session - and stops a POST without a valid CSRF token

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (($_POST['act'] ?? '') === 'save')  { /* ... save $_POST['name'] ... */  sys_redirect('@Saved'); }
    if (($_POST['act'] ?? '') === 'reset') { /* ... */                         sys_redirect('@Reset', 'info'); }
    sys_redirect('@Unknown action', 'warning');                  // Post/Redirect/Get: the message is shown by htm_Page_
}

htm_Page_(titl:'My page');
htm_Card_(capt:'@Settings', icon:'fas fa-sliders', form:'f_set', clas:'cardW800');
    htm_Input(labl:'@Name', name:'name', valu:'', wdth:'300px');
    htm_AcceptButt(labl:'@Save',  icon:'fas fa-floppy-disk', kind:'save', form:'f_set', valu:'save');
    htm_AcceptButt(labl:'@Reset', icon:'fas fa-rotate-left', kind:'eras', form:'f_set', valu:'reset');
htm_Card_end();
htm_Page_end();

Functions

★ = core element. Line numbers refer to php2html.lib.php 1.9.2.

Page

htm_GoTopButt

Special buttons for going to top/middle/bottom of page

htm_GoTopButt(labl:'@Top', icon:'fa-solid fa-arrow-up', hint:'@Go to page top', styl:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 2938

Param Default Description
labl '@Top' string: Button label
icon 'fa-solid fa-arrow-up' string: Icon before label
hint '@Go to page top' string: User hint
styl '' string: Button custom style
rtrn false bool: Return the HTML instead of echoing it

htm_ThemeButt

A button that cycles the page theme: light -> dark -> auto (follows the operating system) -> custom. The choice is remembered.

htm_ThemeButt(labl:'', hint:'@Switch theme: light, dark, automatic (follows the system) or your own colors', rtrn:false) - echoes; rtrn:true returns the HTML - line 3308

Param Default Description
labl '' string: Optional text before the current theme name
hint '@Switch theme: light, dark, automatic (follows the system) or your own colors'
rtrn false bool: Return or echo result

htm_LangSelect

Language selector with flags (used in the view bar): the languages that have translations, plus English

htm_LangSelect(rtrn:false) - echoes; rtrn:true returns the HTML - line 3388

Param Default Description
rtrn false bool: Return or echo result

htm_QuickBar

always in reach (from TinyCash, the buttons given by the program)

htm_QuickBar(list:[], rtrn:false) - echoes; rtrn:true returns the HTML - line 3515

Param Default Description
list [] array: The buttons: [[0:link, 1:labl, 2:icon, 3:hint, 4:colr (a small dot), 5:acti (JavaScript instead of the link), 6:form (the id of a form: a submit button of it - anywhere on the page), 7:name (the button's name, posted as name=1)], ...] e.g. ['', '@Save', 'fa-solid fa-floppy-disk', '@Save the order', '', '', 'orderForm', 'save']
rtrn false bool: Return or echo result

htm_PageHelp

Help for the page: a "?" button (in the view bar) and a movable window with the help text of this page (from TinyCash)

htm_PageHelp(rtrn:false) - echoes; rtrn:true returns the HTML - line 3547

Param Default Description
rtrn false bool: Return or echo result

htm_ViewBar

user: the logged in user is shown at the end of the bar - lout: the address that logs out (a sign-out button beside the name)

htm_ViewBar(user:'', lout:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 3623

Param Default Description
user '' string: Name of the logged in user ('' = not shown)
lout '' string: Logout URL ('' = no logout button)
rtrn false bool: Return or echo result

htm_ThemeEditor

Editor for the user's own theme: pick a few base colors, see the result live, save it in this browser.

htm_ThemeEditor(rtrn:false) - echoes; rtrn:true returns the HTML - line 3744

Param Default Description
rtrn false bool: Return or echo result

htm_Banner

A banner across the page: a short notice with a colored edge, e.g. "Demo data" or "Read only" (from NH-logistik)

htm_Banner(body:'', kind:'warning', rtrn:false) - echoes; rtrn:true returns the HTML - line 4478

Param Default Description
body '' string: The text (HTML allowed, translated with lang())
kind 'warning' string: info / warning / danger / success
rtrn false bool: Return or echo result

htm_Page_

★ core element

Start creating a page

htm_Page_(titl:'', hint:'', algn:'center', attr:'', info:'', inis:'', imag:'', pbrd:true) - line 5341

Param Default Description
titl '' string: Page title
hint '' string: Page tip (vertical text - left) - plain text
algn 'center' string: align - "text-align"
attr '' string: Page attributes
info '' string: Page info (vertical text - right) - plain text
inis '' string: Page initial CSS/js script in page header
imag '' string: Page background-image
pbrd true bool: Draw border around the page body-div

htm_Page_Sect

A paragraf with border, can be used as a page-footer, or separator on a page.

htm_Page_Sect(body, styl:'border: 1px solid #888; border-radius: 8px; overflow: hidden; margin: auto; background-color:white;', rtrn:false) - echoes; rtrn:true returns the HTML - line 7080

Param Default Description
body required
styl 'border: 1px solid #888; border-radius: 8px; overflow: hidden; margin: auto; background-color:white;'
rtrn false bool: Return the HTML instead of echoing it

htm_Page_end

Finalize the htm_Page_()

htm_Page_end() - line 7090

Cards and layout

htm_Details

A summery list with collapsible details

htm_Details(capt:'', labl:'', hint:'', type:'h1', mode:'', body:'', styl:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 1054

Param Default Description
capt '' string: The header text
labl '' string: The details summary
hint '' string: Hidden description
type 'h1' string: Header type (h1..h6)
mode '' string: Initial mode: 'open'/''
body '' string: The details text
styl '' string: Styles for capt & body & labl
rtrn false bool: Function Return or echo result

htm_Fieldset

Start a bordered area with a caption, icon ant hint (Remaned from: htm_Fieldset_)

htm_Fieldset(capt:'', icon:'', hint:'', wdth:'', marg:'', styl:'', attr:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 1988

Param Default Description
capt '' string: The fieldset caption
icon '' string: Class: icon to the left of fieldset caption
hint '' string: The hint on hover caption
wdth '' string: fieldset width
marg '' string: fieldset margin-size
styl '' string: fieldset style
attr '' string: legend attributes
rtrn false bool: Function Return or echo result

htm_Fieldset_end

End a bordered area

htm_Fieldset_end(rtrn:false) - echoes; rtrn:true returns the HTML - line 2010

htm_Row_

Prepare a span with inline-block output

htm_Row_(rtrn:false) - echoes; rtrn:true returns the HTML - line 2093

htm_Row_end

Finalize the span

htm_Row_end(rtrn:false) - echoes; rtrn:true returns the HTML - line 2100

htm_Card_

★ core element

An advanced span with lots of functionality

htm_Card_(capt:'', icon:'', hint:'tgl', mode:'2', form:'', acti:'', wdth:'', vhgh:'600px', fclr:'', styl:'background-color: white;', attr:'margin-bottom: 8px;', clas:'cardWmax', show:true, poup:true, head:'background-color: white;', help:'', frst:'', last:'', simp:false, fold:'', elem:'span', move:true, rtrn:false) - echoes; rtrn:true returns the HTML - line 2146

Param Default Description
capt '' string: The card caption
icon '' string: Class: icon to the left of caption
hint 'tgl' string: The hint on the caption ('tgl': "click to open / close this card", '': none)
mode '2' string: The buttons: '0' none / '1' toggle the height / '2' also: toggle the width, close all, open all
form '' string: The name (and id) of a form around the card body - '' no form. Not inside a card that has a form (no nested forms)
acti '' string: The action of the form ('' this page). The form is POST, multipart, with the CSRF token
wdth '' string: The width of the folded card (a number is px), e.g. '240px' - '' the same width
vhgh '600px' string: The max height of the body - more content scrolls ('none': no limit)
fclr '' string: Extra style of the header icons and text, e.g. 'color:snow;'
styl 'background-color: white;' string: Style of the card body
attr 'margin-bottom: 8px;' string: Style of the card itself (the outer element)
clas 'cardWmax' string: The width class: cardWmax (full), cardWaut (the content), cardW120 (1200px), cardW110, cardW100, cardW960, cardW800, cardW720, cardW640, cardW560, cardW480, cardW400, cardW320, cardW280, cardW240, cardW160
show true bool: Show the buttons at the right in the header
poup true bool: Right-click the header: a menu for all cards (heights, close / open all, original order)
head 'background-color: white;' string: Style of the header
help '' string: A link: a ? icon in the header opens it in a new window
frst '' string: HTML at the left in the header (the caption is then centered)
last '' string: HTML at the right in the header - it replaces the buttons (show/mode)
simp false bool: A simple header: only the centered caption (no buttons, no frst/last)
fold '' string: 'closed': the card starts folded (click the caption to open it)
elem 'span' string: The HTML element of the card: span (default) / section / article / aside / main / header / footer / div A semantic element (section...) gets the caption as its accessible name (aria-labelledby)
move true bool: The card can be moved among its sibling cards (how: $gbl_CardMove) - false: it stays in place
rtrn false bool: Return the HTML instead of echoing it

htm_Card_end

Finalize htm_Card_()

htm_Card_end(labl:'', icon:'', hint:'', kind:'save', name:'', form:'', attr:'', subm:false, akey:'', simu:false, foot:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 2347

Param Default Description
labl '' string: The label of the submit button in the footer
icon '' string: An icon left of the label
hint '' string: The hint of the button ('' a reminder to save)
kind 'save' string: The color of the button: save, navi, goon, eras, crea, home, get_, put_, spc1, spc2
name '' string: (Only a comment after )
form '' string: The form to submit - in a card with its own form: always that form
attr '' string: Attributes of the button
subm false bool: A submit button in the footer - only in a card with its own form (form: in htm_Card_)
akey '' string: Access key of the button (Alt+key)
simu false bool: (Not used)
foot '' string: Footer text (HTML, translated) - the footer stays below the scrolling body and is hidden with it when the card is folded
rtrn false bool: Return the HTML instead of echoing it

htm_Wrapp_

Start a span with scrolling content in a fixed-height window

htm_Wrapp_(vhgh:'400px', rtrn:false) - echoes; rtrn:true returns the HTML - line 2599

Param Default Description
vhgh '400px' WrapperCard - vhgh: ViewHeight
rtrn false

htm_Wrapp_end

Finalize a wrapper window

htm_Wrapp_end(rtrn:false) - echoes; rtrn:true returns the HTML - line 2606

htm_RowCol_

Start a first column in a div

htm_RowCol_(wdth:240, rtrn:false) - echoes; rtrn:true returns the HTML - line 2714

htm_RowCol_next

Create the next column

htm_RowCol_next(wdth:320, rtrn:false) - echoes; rtrn:true returns the HTML - line 2725

htm_RowCol_end

Create the last column

htm_RowCol_end(rtrn:false) - echoes; rtrn:true returns the HTML - line 2733

htm_Tabs_

Start a tab-object with multibly tabs

htm_Tabs_(head:'', styl:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 4079

htm_Tab

★ core element

Create a tab in the htm_Tabs_() object

htm_Tab(labl:'', name:'', body:'', vhgh:'', bclr:'white', styl:, dflt:false) - line 4095

Param Default Description
labl '' string: Tab Label
name '' string: id
body '' string: Content on tab
vhgh '' string: ViewHeight (future !)
bclr 'white' string: Background color
styl `` string: Style
dflt false boolean: Open as default

htm_Tabs_end

Finalize a htm_Tabs_() object

htm_Tabs_end(foot:'', styl:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 4123

Forms and input

htm_Input

★ core element

An advanced object rel. in-output of data

htm_Input(labl:'', icon:'', hint:'', plho:'@Enter...', vrnt:'text', name:'', valu:'', list:[], form:'', wdth:'100%', algn:'left', bord:'', attr:'', unit:'', disa:false, rows:'2', step:'', llgn:'R', ftop:'', lpos:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 287

Param Default Description
labl '' string: Translated label above the input field
icon '' string: The icon left of the label (label prefix)
hint '' string: Translated description for the field
plho '@Enter...' string: Translated placeholder shown when field is empty. Default: Enter...
vrnt 'text' string: The variant: text (default) - area (several lines, rows:) - html (formatted text, editable) - pass (password, show / hide and a strength meter; rows:'0' no meter) - mail - link (URL) - phon - sear (search) - intg (whole number, step:) - num0 / num1 / num2 / num3 (number with 0-3 decimals) - dec0 / dec1 / dec2 (amount with thousands separator; unit: '<kr' prefix, 'kr' suffix) - date - time - week - mont (month) - rang (slider) - colr (colour) - file (upload: the form needs enctype multipart/form-data, as htm_Card_ form: and htm_Form_ have) - imag (image button) - barc (text in a bar code font) - chck (checkboxes) / rado (radio buttons) / opti (select list): the choices in list: - hidd (hidden) - butt (plain button, no action) / subm (submit button)
name '' string: Set the fields name (and id)
valu '' string: The current content in input field
list [] array: The choices of chck / rado / opti: [[value, '@Label', '@Hint', 'checked' or 'selected', attributes], ...] (chck: the value is the name of each checkbox in $_POST)
form '' string: With Local form given, click on showed OK-butt to submit
wdth '100%' string: Width of the field-container
algn 'left' string: The alignment of input content Default: left
bord '' string: BoxBorder color to mark required/optional field. Default= 'border: 1px solid var(--grayColor);' htm_Input() only:
attr '' string: Give more (special / non system) input attrib to the input (height priority)
unit '' string: A unit added to the content eg. currency or % If in front: '<' it is added as a prefix, else a suffix
disa false bool: Disable the field. Default: field is active
rows '2' string: Number of rows in multiline input (eg. area/html) Default: 2 (Radio/Check-list: 1 to output horisontal)
step '' string: the value of stepup/stepdown for numbers
llgn 'R' string: Label align Default: Right
ftop '' string: Ajust field vertical position
lpos '' string: style rel. Label offset (chck)
rtrn false bool: Act as procedure: Echo result, or as function: Return string

htm_Inbox

A ontainer with: Border, Label, Hint, (Placeholder)

htm_Inbox(labl:'', icon:'', hint:'', plho:'@Enter...', vrnt:'noUse', name:'Body_div', valu:'', list:['noUse'], form:'noUse', wdth:'200px', algn:'left', bord:'1px solid var(--grayColor);', attr:'', unit:'noUse', disa:false, rows:'noUse', step:'noUse', llgn:'R', ftop:'', edit:null, rtrn:false) - echoes; rtrn:true returns the HTML - line 580

Param Default Description
labl '' string: Translated label above the input field
icon '' string: The icon left of the label
hint '' string: The Translated description for the field
plho '@Enter...' string: The placeholder shown with blank value
vrnt 'noUse' string: Variant
name 'Body_div' String: Set the Editable name (and id)
valu '' string: The HTML content of the box-body
list ['noUse']
form 'noUse'
wdth '200px' string: The outher Width of the field-container
algn 'left' string: The alignment of input content Default: left
bord '1px solid var(--grayColor);' string: BoxBorder color to mark required/optional field. Default= 'border: 1px solid var(--grayColor);'
attr '' string: Give more (special / non system) attrib to the field
unit 'noUse'
disa false bool: (Old) true makes the box editable - the opposite of disa elsewhere: use edit
rows 'noUse'
step 'noUse'
llgn 'R' string: Label align Default: Right
ftop '' string: Ajust field vertical position
edit null bool: true: the content can be edited (use this - not disa)
rtrn false bool: Act as procedure: Echo result, or as function: Return string

htm_Output

★ core element

General output for pt. Progress etc.

htm_Output(labl:'', icon:'', hint:'', vrnt:'pgrs', name:'', valu:'', form:'', bclr:'white', attr:'', vmax:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 667

Param Default Description
labl '' string: The caption text
icon '' string: comming new (label prefix)
hint '' string: The hint/tooltip
vrnt 'pgrs' string: Variant (outp/pgrs)
name '' String: Set the name/id
valu '' string: The actual value / list of other elements' ids
form '' String: Form name
bclr 'white' string: span background-color
attr '' string: Give more (special / non system) attrib to the field
vmax '' string: The Max value
rtrn false bool: Act as procedure: Echo result, or as function: Return string

htm_Field

Make a box like htm_input() with label, icon and hint

htm_Field(labl:'', icon:'', hint:'', name:'fld', body:'', wdth:'', styl:'', attr:'', llgn:'C', ftop:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 2051

Param Default Description
labl '' string: label for the box
icon '' string: Class: icon to the left of the label
hint '' string: The hint on hover label
name 'fld' string: field name
body '' string: Html content
wdth '' string: field width
styl '' string: field style
attr '' string: field attributes
llgn 'C' string: label align L/C/R
ftop '' string: fieldtop: label y-offset
rtrn false bool: Act as procedure: Echo result, or as function: Return string:

csrf_field

A hidden field with the CSRF token of the session - for your own forms (htm_Card_ form: and htm_Form_ add it themselves)

csrf_field(rtrn:false) - echoes; rtrn:true returns the HTML - line 2113

csrf_verify

A POST must carry the token of the session: the field csrf_token, or the header X-CSRF-Token (p2hPost / fetch) - true / false

csrf_verify() - line 2118

htm_DataList

An input field with a list of values to pick from (HTML datalist)

htm_DataList(capt:'@Choose here from the list:', icon:'fas fa-database', hint:'@Use datalist to pick a value from list', plho:'@Type or pick a value', name:'', data:['Itm1','Itm2','Itm3','Itm4'], form:'', acti:'', wdth:'220px', bord:'1px solid black; border-radius: 5px;', fclr:'color: green;', attr:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 2484

Param Default Description
capt '@Choose here from the list:' string: The group caption
icon 'fas fa-database' string: Icon left to label
hint '@Use datalist to pick a value from list' string: Hint on hover the submit button
plho '@Type or pick a value' string: The placeholder shown when blank value
name '' string: The field name submitted with the choice. '' => datalist1, datalist2...
data ['Itm1','Itm2','Itm3','Itm4'] array: Record with Data
form '' string: The name of the form to submit
acti '' string: Form action
wdth '220px' string: the width
bord '1px solid black; border-radius: 5px;' string: The group border style
fclr 'color: green;' Special header forground-style (Icon, text and arrow-icons). Ex.: fclr:'color:snow;'
attr '' string: additional style
rtrn false bool: Act as procedure: Echo result, or as function: Return string:

htm_Form_

Start creating a form

htm_Form_(name:'', type:'multipart/form-data', mode:'POST', acti:'', attr:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 2613

Param Default Description
name '' string: The name of the form
type 'multipart/form-data' string: enctype
mode 'POST' string: Form method
acti '' string: Form action
attr '' string: Other attributes
rtrn false bool: Return the HTML instead of echoing it

htm_Form_end

Finalixe a form

htm_Form_end(rtrn:false) - echoes; rtrn:true returns the HTML - line 2639

htm_NotePad

A personal notepad: plain text, saved automatically in this browser (the same notes on all pages of the site) - from TinyCash

htm_NotePad(rtrn:false) - echoes; rtrn:true returns the HTML - line 3448

Param Default Description
rtrn false bool: Return or echo result

sys_switchIsOn

Is a switch value "on"? Accepts 1/true/on/yes/checked/pressed (and the old spelling "presssed")

sys_switchIsOn(valu) - line 3773

htm_SwitchButt

A button with switch layout

htm_SwitchButt(labl:'', hint:'', name:'switchbox_id', valu:'', list:[], wdth:'', bclr:'', styl:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 3779

Param Default Description
labl '' string: Button label
hint '' string: Hint about the button function
name 'switchbox_id' string: Button name
valu '' string: Value
list [] array: Setting
wdth '' string: Width
bclr '' string: Background color
styl '' string: Style
rtrn false bool: Function Return or echo result

htm_SwitchButton

Another button with switch layout

htm_SwitchButton(labl, hint:'', name:'switchbox_id', valu:'', list:[], wdth:'', bclr:'', styl:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 3817

Param Default Description
labl required string: Button label
hint '' string: Hint about the button function
name 'switchbox_id' string:
valu '' string:
list [] string:
wdth '' string: Width
bclr '' string:
styl '' string:
rtrn false bool: Act as procedure: Echo result, or as function: Return string

htm_MultistateButt

A special button to switch between many states

htm_MultistateButt(name:'ROWyCOLx', valu:'', acti:true, styl:'padding:1px;', rtrn:false) - echoes; rtrn:true returns the HTML - line 3877

Param Default Description
name 'ROWyCOLx' string: Name of the field
valu '' string: State 0..3
acti true bool: Clickable
styl 'padding:1px;' string: Style
rtrn false bool: Echo the HTML (default - as all functions since 1.7.2; was true) or return it

htm_Humantest

Button for test human or robot

htm_Humantest(capt:'@Are you human? ', icon:'fa-solid fa-arrow-right-to-bracket', hint:'@Grab and slide to right to change state', form:'form-id', wdth:'200px', vhgh:'24px', bclr:'#1bd441', yclr:'lightgray', nclr:'white', xytx:'@YES', ntxt:'@NO', rtrn:false, hght:null) - echoes; rtrn:true returns the HTML - line 3920

Param Default Description
capt '@Are you human? ' string: capt $quest= '@Are you human?',
icon 'fa-solid fa-arrow-right-to-bracket' string: icon after caption
hint '@Grab and slide to right to change state' string: hint $slide_hint= '@Grab and slide to right to change state'
form 'form-id' string: form $form_id= 'form-id',
wdth '200px' string: wdth $grab_width= '200px',
vhgh '24px' string: height of the slider
bclr '#1bd441' string: background in human state
yclr 'lightgray' string: yclr $yclr= 'lightgray',
nclr 'white' string: nclr $no_colr= 'white',
xytx '@YES' string: xytx $yes_text= '@YES',
ntxt '@NO' string: ntxt $no_text= '@NO',
rtrn false bool: Act as procedure: Echo result, or as function: Return string
hght null (Old name of vhgh - still works)

htm_TextArea

Create a HTML-textarea with multibly lines

htm_TextArea(labl:'', hint:'', plho:'?', name:'area', valu:'', form:'', wdth:'', attr:'', rows:'1', rtrn:false, widt:null) - echoes; rtrn:true returns the HTML - line 4155

Param Default Description
labl '' string: Label after the field
hint '' string: Hint on the label
plho '?' string: Placeholder
name 'area' string: Name and id
valu '' string: The text
form '' string: The form the field belongs to (when it is outside it)
wdth '' string: Width
attr '' string: More style
rows '1' string: Number of rows
rtrn false bool: Echo the HTML (default - as all functions since 1.7.2; was true) or return it
widt null (Old name of wdth - still works)

sys_toFloat

A number written as "1 234,50" / "1.234,50" / "1234.50" / "87 %" / "kr. 12,5" -> float ((float)"1 234,50" gives 1)

sys_toFloat(v) - line 7304

Buttons and links

htm_AcceptButt

★ core element

A button for different purposes with colors according to purpose: Delete/Create/Navigate/Continue/Submit

htm_AcceptButt(labl:'', icon:'', hint:'', kind:'home', form:'', acti:'', wdth:'', attr:'', akey:'', tplc:'LblTip_text', tsty:'', idix:'', disa:false, name:'', valu:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 2742

Param Default Description
labl '' string: The caption on the button
icon '' string: The iconclass (' ';)
hint '' string: hint about the button function
kind 'home' string: save, navi, goon, erase, create, home (rel. Appearance)
form '' string: The form the element belongs to, if a name is given
acti '' string: Function to run, or submit if empty
wdth '' string: The width of the button
attr '' string: Generel use e.g. ' action= "$link" '
akey '' string: Shortcut to activate the button
tplc 'LblTip_text' string: Class for Placement of the tooltip
tsty '' string: Style for Placement of the tooltip
idix '' string: ix-suffix on name/id
disa false bolean: 'disabled' to deactivate the button
name '' string: With valu: the name the value is posted under (default 'act')
valu '' string: The value this button posts - several actions in one form: read $_POST['act'] (name:). No reload on click
rtrn false bool: Act as procedure: Echo result, or as function: Return string

htm_ActionButt

A generel action button

htm_ActionButt(labl:'', icon:'', hint:'', type:'button', name:'', form:'', acti:'', attr:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 2830

Param Default Description
labl '' string: Text on the button
icon '' string: Icon before the label
hint '' string: Hint about the button function
type 'button' string:
name '' string: The name and id for the button
form '' string: The form button belongs to
acti '' string: Function to run
attr '' string: Button attributes.
rtrn false bool: Echo the HTML (default - as all functions since 1.7.2; was true) or return it

htm_IconButt

★ core element

A generel botton with icon and label

htm_IconButt(labl:'', icon:'', hint:'', type:'submit', name:'', link:'', evnt:'', wdth:'', font:'32px', fclr:'#555', bclr:'white', akey:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 2867

Param Default Description
labl '' string: Button label
icon '' string: Icon before label
hint '' string: User hint
type 'submit' string: Button type
name '' string: Button id / name
link '' string: formtarget
evnt '' string: Event script (earlier: $action)
wdth '' string: Width
font '32px' string: font-size
fclr '#555' string: Forground color (gray gave too little contrast)
bclr 'white' string: Background color
akey '' string: Keyboard shortcut
rtrn false bool: Function Return or echo

htm_SubmitButt

Submit button with hint

htm_SubmitButt(labl:'', hint:'', type:'submit', wdth:'', font:'32px', fclr:'#555', bclr:'white', rtrn:false) - echoes; rtrn:true returns the HTML - line 2913

Param Default Description
labl '' string: Button label
hint '' string: User hint
type 'submit' string: Button type
wdth '' string: Minimum Width
font '32px' string: font-size
fclr '#555' string: Forground color (gray gave too little contrast)
bclr 'white' string: Background color
rtrn false bool: Function Return or echo

htm_LinkButt

A general link-button

htm_LinkButt(labl:'', hint:'', link:'', targ:'_blank', attr:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 4141

Param Default Description
labl '' string: Label
hint '' string:
link '' string:
targ '_blank' string:
attr '' string:
rtrn false bool: Function Return or echo result

htm_ConfirmPostLink

A button for an action that changes data (e.g. Delete): asks "Are you sure?" and then POSTs with the CSRF token (from NH-logistik)

htm_ConfirmPostLink(labl:'', icon:'', hint:'', kind:'danger', mess:'@Are you sure?', data:[], acti:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 4502

Param Default Description
labl '' string: Button text
icon '' string: Icon class, e.g. 'fa-solid fa-trash'
hint '' string: Tooltip
kind 'danger' string: primary / secondary / success / danger / warning / info (button color)
mess '@Are you sure?' string: The question
data [] array: The fields to send: ['name' => 'value', ...]
acti '' string: Where to POST ('' = this page)
rtrn false bool: Return or echo result

Messages and dialogs

htm_MiniNote

A very small text line

htm_MiniNote(note:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 962

Param Default Description
note ''
rtrn false bool: Return the HTML instead of echoing it

htm_TextTip

A text with a caption on colored line

htm_TextTip(capt:'TIP', body:'', wdth:'', algn:'center', colr:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 971

Param Default Description
capt 'TIP' string: The output caption
body '' string: The output text
wdth '' string: The div width
algn 'center' string: The div alignment
colr '' string: the background-color
rtrn false bool: Return the HTML instead of echoing it

htm_TextHint

A div containing a text with a hidden hint

htm_TextHint(text:'Visibly Text', hint:'Hidden description', styl:'background-color: white; ', attr:, rtrn:false) - echoes; rtrn:true returns the HTML - line 1009

Param Default Description
text 'Visibly Text' string: Visibly Text
hint 'Hidden description' string: Hidden description
styl 'background-color: white; ' string: Outher style (div-container)
attr `` string: Inner style (span-popup)
rtrn false bool: Function Return or echo result

htm_ModalDialog

Create a modal popup window with color-coded background

htm_ModalDialog(capt:'@Voilà!', type:'none', mess:'', html:'CSS-based Modal Dialog', butt:['$type','$icon','$labl','$hint','$link'], rtrn:false) - echoes; rtrn:true returns the HTML - line 4197

Param Default Description
capt '@Voilà!'
type 'none' Variant
mess ''
html 'CSS-based Modal Dialog'
butt ['$type','$icon','$labl','$hint','$link']
rtrn false bool: Echo the HTML (default - as all functions since 1.7.2; was true) or return it

htm_Alert

A message box in the page: success / error / warning / info - theme colors, also in the dark theme (from NH-logistik)

htm_Alert(body:'', kind:'success', wdth:'700px', rtrn:false) - echoes; rtrn:true returns the HTML - line 4287

Param Default Description
body '' string: The message (HTML allowed, translated with lang())
kind 'success' string: success / error / warning / info
wdth '700px' string: Max width
rtrn false bool: Return or echo result

sys_redirect

After a POST: remember a message and load the page again with GET (Post/Redirect/Get) - the next htm_Page_ shows it (htm_Flash)

sys_redirect(mess:'', kind:'success', link:'') - line 4302

Param Default Description
mess '' string: The message on the next page (HTML, translated with lang()) - '' none. Escape user data with sys_enc()
kind 'success' string: success / error / warning / info
link '' string: Where to go - '' the same address again (with its query string)

htm_Flash

The messages of sys_redirect(): each shown once. htm_Page_ calls it ($gbl_Flash= false: not) - call it yourself to show them elsewhere

htm_Flash(wdth:'700px', rtrn:false) - echoes; rtrn:true returns the HTML - line 4316

Param Default Description
wdth '700px' string: Max width of each message
rtrn false bool: Return or echo result

htm_Badge

A small label: a status, a count or "New" - e.g. in tables and menus (from NH-logistik)

htm_Badge(labl:'', hint:'', kind:'secondary', rtrn:false) - echoes; rtrn:true returns the HTML - line 4490

Param Default Description
labl '' string: The text (translated with lang())
hint '' string: Tooltip
kind 'secondary' string: primary / secondary / success / danger / warning / info
rtrn false bool: Return or echo result (rtrn:true to use it inside other output)

htm_Dialog

★ core element

Create a Dialog with alternative buttons to select between

htm_Dialog(capt:'CAPTION', labl:'@Open dialog', body:'', bclr:'lightyellow', butt:[ ['confirmBtn','default','@Confirm','fas fa-check','green','@Accept and go on'],, rtrn:false) - echoes; rtrn:true returns the HTML - line 4602

Param Default Description
capt 'CAPTION'
labl '@Open dialog' string: Label of the button that opens the dialog ('' = no button; open it with: document.getElementById("htmDialog1").showModal())
body ''
bclr 'lightyellow' Background color
butt [ ['confirmBtn','default','@Confirm','fas fa-check','green','@Accept and go on'], (0:id, 1:value, 2:label, 3:icon, 4:color, 5:hint)
rtrn false bool: Return or echo result

Tables and data

sys_csvCell

so Excel/LibreOffice does not execute it as a formula (CSV injection). Real numbers like -12.50 are left alone.

sys_csvCell(v) - line 1314

htm_Table

★ core element

A table with records: sort, filter, edit, add rows and export to CSV

htm_Table(capt:[], pref:[], body:[], suff:[], note:'', list:['',''], data:[], wdth:'98%', vhgh:'400px', styl:'', filt:true, sort:true, crea:true, modi:true, from:__FILE__, expo:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 1321

Param Default Description
capt [] array: Fields above the table: [0:labl, 1:wdth, 2:type, 3:name, 4:algn, 5:hint, 6:plho, 7:valu] type: show (only the text) / rows (the number of rows + 6) / html (7 as HTML) / data (a field with name 3 - posted) / text, number, date ... (a field without name - not posted). Shown only when the table has data.
pref [] array: Columns before the data: [0:labl, 1:wdth, 2:-, 3:-, 4:[algn], 5:hint, 6:html] 6 is the same HTML in every row; name="x" becomes name="i_x"
body [] array: The data columns: [0:labl, 1:wdth, 2:type, 3:frmt, 4:[style], 5:fkey, 6:hint, 7:plho, 8:calc, 9:[list, css]] 2 type: text data area sttu (field) / show (read only) / intg (integer) / date / ddwn (select, 9) / opti (htm_Input option field, 9) chck (checkbox) / bold ital (read only: is the text bold/italic) / indx keyn (the value as a link, clickable) html htm0 (the value as HTML) / blnk (nothing) / hidd (hidden, posted) / calc (a number from field 8) / vars (old select) 3 frmt: 0d 1d 2d (decimals) / 2% (2 decimals + %) / >0 (blank when 0 or less) / '= ' (always blank) / B R L (bold #00000, red, blue - type html) 4 style: [0:text-align, 1:cell background, 2:field style (text fields), 3:cell background (row marking), 4:font-size] 5 fkey: the field name - posted as fkey[] (one value per row, in the order of the rows) 8 calc: fn($row) => number - $row is [fkey => value], e.g. fn($r) => toNum($r['qty']) * toNum($r['price']) 9 list: [[[value, label, hint], ...], 'css of the select'] (ddwn/opti)
suff [] array: Columns after the data (only with modi): [0:labl, 1:wdth, 2:type, 3:-, 4:[algn], 5:hint, 6:valu] type rowact: row actions in the browser, 6 = 'del copy move undo' (any of them) type button: a submit button named btn_<del|hid|cpy|ren|sel> - by 0: @Delete @Hide @Copy @Rename @Select, 6 = its icon else: 6 is shown as HTML (an "open-modal_N" in it opens one dialog per row)
note '' string: HTML below the table ('' with filt: a hint about the filter)
list ['',''] array: The row rules of customRules.inc.php, e.g. ['KONTOPLAN'] - and the options of 'vars' columns
data [] array: The rows (by reference - give a variable): [[v0, v1, ...], ...] in the order of body, or [[fkey => value, ...], ...]
wdth '98%' string: The width of the table
vhgh '400px' string: The height of the scrolling window with the rows (the header stays)
styl '' string: Style for the span that holds the table
filt true bool: A filter field below each header
sort true bool: Sort by clicking a header (SHIFT+click: by more columns)
crea true bool: A button that adds an empty row - a string is the label of the button
modi true bool: The fields can be changed, and the suffix columns are shown
from __FILE__ string: Where the table is made (FILE / FUNCTION) - shown by indx/keyn clicks
expo '' string: Also write the data to this CSV file (UTF-8, Excel-safe)
rtrn false bool: Return the HTML instead of echoing it

htm_DataGroup

A span/group with a set of labels and data

htm_DataGroup(capt:'', icon:'', hint:'', data:[['Label0','Data0','Lstyl','Dstyl']], wdth:'', vhgh:'600px', bord:'3px solid black;', fclr:'', styl:'', attr:'', head:'', foot:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 2437

Param Default Description
capt '' string: The group caption
icon '' string: Icon left to label
hint '' string: Hint on hover the submit button
data [['Label0','Data0','Lstyl','Dstyl']] array: Records with label, Data and style
wdth '' string: group width
vhgh '600px' string: ViewHeight for group with scrollable content
bord '3px solid black;' string: The group border style
fclr '' Special header forground-style (Icon, text and arrow-icons). Ex.: fclr:'color:snow;'
styl '' string: Custom style for div containing data
attr '' string: additional style for the ScrollWindow
head '' string: The group header
foot '' string: The group footer
rtrn false bool: Return the HTML instead of echoing it

htm_TableTools

Search and sort for a table - without jQuery: a search field with "x of y rows", and sorting by clicking a column header (from NH-logistik)

htm_TableTools(tabl:'', plho:'@Search...', srch:true, sort:true, rtrn:false) - echoes; rtrn:true returns the HTML - line 4534

Param Default Description
tabl '' string: id of the table ('' = the next table on the page, e.g. the htm_Table() that follows)
plho '@Search...' string: Placeholder in the search field
srch true bool: Show the search field
sort true bool: Sort by clicking a header (only when Tablesorter is not active on the table - it sorts itself)
rtrn false bool: Return or echo result

Charts

htm_Chart

A bar or line chart as plain SVG (no JavaScript library) - e.g. prices per hour, sales per month. Charts with the same ymin / ymax share one scale

htm_Chart(capt:'', vrnt:'bar', data:[], mark:[], curr:null, unit:'', deci:2, ymin:null, ymax:null, colr:['#7f9bb5','#2fa84f'], wdth:'760px', vhgh:'220px', rtrn:false) - echoes; rtrn:true returns the HTML - line 4328

Param Default Description
capt '' string: A caption above the chart (translated with lang()) - also the name a screen reader says
vrnt 'bar' string: bar / line
data [] array: The values in order: ['label' => number, ...] - the labels are shown below (as many as there is room for) and in the hints
mark [] array: Labels drawn in the second colour of colr, e.g. the chosen hours: ['03:00', '03:15'] (line: a dot)
curr null string: The label of the current point - outlined in red ("now")
unit '' string: The unit after the values in the hints, e.g. 'kr/kWh'
deci 2 int: Decimals of the values in the hints
ymin null float: The bottom of the scale - null: 0, or the lowest value when it is negative
ymax null float: The top of the scale - null: the highest value
colr ['#7f9bb5','#2fa84f'] array: [the colour of the values, the colour of mark]
wdth '760px' string: Max width - the chart scales down on small screens
vhgh '220px' string: The height of the drawing area
rtrn false bool: Return or echo result

Log in

sys_login

Log in with a password - a growing wait after wrong tries (5 s, 10 s, 20 s ... at most 15 min), for all browsers together. '' = logged in, else the reason

sys_login(hash:'', pass:'', user:'', file:'') - line 4390

Param Default Description
hash '' string: password_hash() of the right password (of this user) - '' : no password is set, never logged in
pass '' string: The password that was typed
user '' string: The user name - kept in the session (sys_loginUser()); the wait counts per user name
file '' string: The file that keeps the wrong tries (JSON) - '' : in the temp folder of the server, one per program folder

sys_loginUser

The user name of the session after sys_login() - '' : not logged in ('-' : logged in without a user name)

sys_loginUser() - line 4422

sys_logout

Log out: forget the login of the session (a new session id) - written in the activity log when p2h_audit.inc.php is included

sys_logout() - line 4425

sys_loginRequired

A page that needs a login: true when logged in. Else it remembers this address (a GET) for sys_loginBack() and - with link - goes to the log-in page

sys_loginRequired(link:'') - line 4432

Param Default Description
link '' string: The log-in page - '' : stay here (the page shows htm_Login() itself) and return false

sys_loginBack

After sys_login(): the address sys_loginRequired() remembered (once) - else $dflt. Only a path on this site (never another site)

sys_loginBack(dflt:'') - line 4443

Param Default Description
dflt '' string: Where to go when nothing was remembered - '' : the same address

htm_Login

What to log in to (list:) is only a wish of the user: check on the server that the user may open it - then keep it in $_SESSION['p2h_list']

htm_Login(capt:'@Log in', icon:'fa-solid fa-right-to-bracket', hint:'', labl:'@Choose', list:[], valu:'', user:false, wdth:'cardW320', rtrn:false) - echoes; rtrn:true returns the HTML - line 4453

Param Default Description
capt '@Log in' string: The caption of the card
icon 'fa-solid fa-right-to-bracket' string: The icon of the caption
hint '' string: A text above the fields (HTML, translated) - e.g. how to get a password
labl '@Choose' string: The label of list: e.g. '@Accounts', '@Shop', '@Department'
list [] array: What to log in to: [[value, '@Label'], ...] - posted as p2h_list. One: posted without a field. None: no field
valu '' string: The chosen one of list: at the start - e.g. the one of the last login
user false bool: Ask for a user name too
wdth 'cardW320' string: The width class of the card (see htm_Card_ clas)
rtrn false bool: Return the HTML instead of echoing it

Text and content

htm_Caption

A caption with icon, label and hint

htm_Caption(labl:'', icon:'', hint:'', algn:'', styl:, rtrn:false) - echoes; rtrn:true returns the HTML - line 738

Param Default Description
labl '' string: The caption text
icon '' string: label prefix
hint '' string: The hint/tooltip
algn '' string: Caption Alignment
styl `` string: Default Caption text style
rtrn false

htm_TextDiv

Text formatted in a div

htm_TextDiv(body:'', algn:'left', marg:'8px', styl:, attr:, rtrn:false) - echoes; rtrn:true returns the HTML - line 757

Param Default Description
body '' string: Html-text inside div (had no default: htm_TextDiv() without body was a fatal error)
algn 'left' string: div-text alignment
marg '8px' string: div margin
styl `` string: Other style
attr `` string: Other style
rtrn false

htm_TextPre

Text displayed in a fixed-width font, and preserves both spaces and line breaks

htm_TextPre(body, algn:'left', marg:'8px', font:'', attr:'', code:false, rtrn:false) - echoes; rtrn:true returns the HTML - line 772

Param Default Description
body required string: Html-text inside pre
algn 'left' string: pre-text alignment
marg '8px' string: Default pre margin
font '' string: pre-text font
attr '' string: Other style
code false bool: convert: <b>bold</b>
rtrn false bool: Act as procedure: Echo result, or as function: Return string

htm_List_

Starting various types ef text list

htm_List_(capt:'', vrnt:'ul', type:'disc', styl:'text-align:left;', strt:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 803

Param Default Description
capt '' string: Html-text
vrnt 'ul' string: Variants:
    an unordered list /
      an ordered list /
    1. a list item /
      a description list
type 'disc' string: List-style marker type (Ref: https://www.w3schools.com/cssref/playdemo.php?filename=playcss_list-style-type)
styl 'text-align:left;' string: Other style rel. body
strt '' string: Index start for ordered list ('' = 1)
rtrn false bool: Function Return or echo result

htm_List_item

A single item in a text list

htm_List_item(labl:'', body:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 827

Param Default Description
labl '' string: Html-text - term/name in a description list
body '' string: Variants:
term/name in a description list. /
an description list
rtrn false bool: Function Return or echo result

htm_List_end

Ending a text list

htm_List_end(rtrn:false) - echoes; rtrn:true returns the HTML - line 841

Param Default Description
rtrn false bool: Function Return or echo result

htm_CodeBox

A span containing syntax formattet php-code

htm_CodeBox(code:'', valu:'', synt:true, repl:false, fmat:'', fold:'', rtrn:false, vlue:null) - echoes; rtrn:true returns the HTML - line 918

Param Default Description
code '' string: php-code with syntax display
valu '' string: Value to replace
synt true bool: Activate syntax output
repl false bool: Do output formattet string
fmat '' string: Format string
fold '' string: 'closed': the code is hidden - a "Show the code" line opens it ('open': shown, can be closed; '': always shown)
rtrn false bool: Function Return or echo result
vlue null (Old name of valu - still works)

htm_TextVer

Vertical orientated text

htm_TextVer(body, algn:'left', marg:'auto', font:'', attr:'', code:false, rtrn:false) - echoes; rtrn:true returns the HTML - line 944

Param Default Description
body required string: Html-text inside div
algn 'left' string: text alignment
marg 'auto' string: Margin (was ignored: "margin: auto" was written after it)
font '' string: text font
attr '' string: Other style
code false bool: convert: <b>bold</b>
rtrn false bool: Return the HTML instead of echoing it

htm_faq

A question with a folded answer (FAQ) - one at a time when they share a grup

htm_faq(ques:'', answ:'', wdth:'', open:false, grup:'', code:false, rtrn:false) - echoes; rtrn:true returns the HTML - line 991

Param Default Description
ques '' string: The question (always visible)
answ '' string: The answer (shown when the question is clicked)
wdth '' string: The width, e.g. '600px' (default: the full width)
open false bool: The answer is shown from the start
grup '' string: Questions with the same grup: opening one closes the others
code false bool: The answer is text, not html: <b>bold</b>
rtrn false bool: Return the HTML instead of echoing it

htm_Figure

A image with caption, label and a hint

htm_Figure(capt:'', labl:'', hint:'', type:'h1', styl:'', imag:'', info:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 1030

Param Default Description
capt '' string: The header text
labl '' string: The figure caption/label
hint '' string: Hidden description
type 'h1' string: Header type (h1..h6)
styl '' string: Styles for the image
imag '' string: Path to the image
info '' string: alternative text
rtrn false bool: Function Return or echo result

htm_iFrame

Output external content in a local frame

htm_iFrame(titl:'', srce:'', wdth:'300px', vhgh:'200px', styl:'', rtrn:false, heig:null) - echoes; rtrn:true returns the HTML - line 2017

Param Default Description
titl '' string: iframe title
srce '' string: Source with html content
wdth '300px' string: iframe width
vhgh '200px' string: iframe height
styl '' string: iframe style (eg. border)
rtrn false bool: Act as procedure: Echo result, or as function: Return string
heig null (Old name of vhgh - still works)

htm_Embed

View a container with a external resource

htm_Embed(name:'', type:'application/pdf', wdth:'800px', vhgh:'2100px', bord:'0', rtrn:false, heig:null) - echoes; rtrn:true returns the HTML - line 2032

Param Default Description
name '' string: Filename and path
type 'application/pdf' string: MIME-type: (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types)
wdth '800px' string: content width
vhgh '2100px' string: content height
bord '0' string: frameBorder
rtrn false bool: Act as procedure: Echo result, or as function: Return string
heig null (Old name of vhgh - still works)

str_WithHint

Create a text with hidden hint/title

str_WithHint(labl:'', hint:'', icon:'', styl:'') - line 4182

Param Default Description
labl '' string: Your text
hint '' string: On-Mouse-over text
icon '' string: Icon prefix
styl '' string: Custom style

htm_Ihead

String function: make italic-text

htm_Ihead(html, rtrn:false) - echoes; rtrn:true returns the HTML - line 7249

str_Synt_

Returns

 - starts a block of program code coloured with str_Synt() (dark background)

str_Synt_() - line 7519

str_Synt_end

Returns

- ends the block of str_Synt_()

str_Synt_end() - line 7521

str_Synt

Returns $elem coloured as program code: $type variable / string / attribute / comment / literal / constant / operator / word / number / default

str_Synt(elem:'', type:'default') - line 7523

Menus

htm_Pmnu_

Init popup context menu group

htm_Pmnu_(capt:'', icon:'', wdth:'210px', attr:'background-color:lightcyan; height: 26px; border: 2px solid lightgray; border-radius: 4px; margin-left: 1px;', elem:'id', stck:'false', cntx:true, rtrn:false) - echoes; rtrn:true returns the HTML - line 4840

htm_Pmnu_Item

Add a popup context menu item

htm_Pmnu_Item(labl:'', icon:'', hint:'', vrnt:'plain', name:'', clck:'', attr:'', shrt:'', enbl:'true', rtrn:false, disa:null) - echoes; rtrn:true returns the HTML - line 4846

htm_Pmnu_end

Finish a popup context menu group

htm_Pmnu_end(labl:'', hint:'', attr:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 4852

htm_Menu_TopDown

A page-menu on top of the page

htm_Menu_TopDown(capt:'Clever html engine', note:'', data:[], wdth:'150px', styl:'', foot:'PHP2HTML', niv0:'', niv1:'', niv2:'', them:true, view:null, rtrn:false) - echoes; rtrn:true returns the HTML - line 4882

Param Default Description
capt 'Clever html engine' string: Title at left
note '' string: Text left to menu
data [] array: Data for the meny - Data(0:vrnt='', 1;icon='', 2:labl='', 3:hint='', 4:desc='', 5:link='', 6:subm=[], 7:styl='')
wdth '150px' string: Widths of menu columns. NOT used yet !
styl '' string: Additional style to default style
foot 'PHP2HTML' string: Text right to menu
niv0 '' string: Style attribute to node niveau 0 (div)
niv1 '' string: Style attribute to node niveau 1 (div class="dropdown")
niv2 '' string: Style attribute to node niveau 2 (data-hint)
them true bool: Show the theme button (htm_ThemeButt) as the last menu item
view null bool: Show the floating view bar (htm_ViewBar: zoom, full screen, theme) instead of the theme button. null: use $gbl_ViewBar
rtrn false bool: Return the HTML instead of echoing it

htm_Menu_Leftout

A page-menu to the left of the page

htm_Menu_Leftout(capt:'Clever html engine', data:[], wdth:'180px', styl:'', foot:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 4999

Param Default Description
capt 'Clever html engine' string: Title at top
data [] array: Data for the menu
wdth '180px' string: Widths of menu columns
styl '' string: Aditional style to default style
foot '' string: Note at bottom
rtrn false bool: Return the HTML instead of echoing it

Small HTML and text helpers

htm_hr

String function: make horisontal line/ruler

htm_hr(colr:'#0', attr:'', rtrn:false) - echoes; rtrn:true returns the HTML - line 7253

htm_br

String function: Add one or more line-breaks

htm_br(rept:1, rtrn:false) - echoes; rtrn:true returns the HTML - line 7257

htm_nl

String function: Add one ore more new line(s)

htm_nl(rept:1, rtrn:false) - echoes; rtrn:true returns the HTML - line 7261

htm_lf

String function: Add one or more linefeed

htm_lf(rept:1, rtrn:false) - echoes; rtrn:true returns the HTML - line 7265

htm_sp

★ core element

String function: Add one ore more nobreaking spaces

htm_sp(rept:1, rtrn:false) - echoes; rtrn:true returns the HTML - line 7269

htm_space

String function: Make a span with given width

htm_space(wdth, rtrn:false) - echoes; rtrn:true returns the HTML - line 7273

str_bold

Returns $source in bold: $result.''.$source.''.$tail (default tail: two non-breaking spaces)

str_bold(source, result:'', tail:'&nbsp;&nbsp;') - line 7279

str_Ihead

Returns a line break and $source in italics - a small heading inside a text

str_Ihead(source) - line 7281

str_hr

Returns a horizontal line (


) in the colour $c, with extra style $attr

str_hr(c:'#0', attr:'') - line 7283

str_br

Returns $rept line breaks (
) - the same as str_nl()

str_br(rept:1) - line 7285

str_nl

Returns $rept line breaks (
) - the same as str_br()

str_nl(rept:1) - line 7287

str_lf

Returns $rept line feeds as - a new line inside an attribute, e.g. a title= hint

str_lf(rept:1) - line 7289

str_sp

Returns $rept non-breaking spaces ( )

str_sp(rept:1) - line 7291

str_space

Returns an empty space $wdth wide (e.g. '20px') - to line up texts

str_space(wdth) - line 7293

Translation and system

sys_get_translations

Reads _trans.sys.json once: a list of the languages (code, name, native, author, note, translation) - the library calls it; English only without the file

sys_get_translations(transTable:[]) - line 7343

lang

lang() is used to translate all hard-coded user interface

lang(text) - line 7409

Param Default Description
text required String: Frase to be transated, with prefix: '@ and with suffix: '

sys_uid

A unique element id on the page: the first keeps its id, repeats get _2, _3... (fields in loops, table rows)

sys_uid(id) - line 7426

sys_enc

Make valid HTML string

sys_enc(text) - line 7435

Internal and helper functions

Not meant to be called by pages (they may change): p2h_progRoot, arrPrint, arrPretty, run_Script, set_Style, highlight_words, highlight_str, highlight_code, invertColor, getOptimalBackground, p2h_assetFiles, p2h_autoLibsOut, p2h_libTags, p2h_rowActs, p2h_capture, spool, isBold, isItal, RowKlick, RowBg, CardInit, getState, CardMin, CardMinimize, CardRange, CardMax, CardOff, CardOn, RowColTest, renderScrollButton, p2h_cssColor, p2h_themeBoot, p2h_flag, p2h_vbHint, notEmpty, in_array_r, msg_Dialog, msg_Error, msg_Info, msg_Warn, msg_Hint, msg_Succ, msg_System, p2h_jsStr, Pmnu_, Pmnu_Item, Pmnu_end, MenuLine, Lbl_Tip, dvl_pretty, dvl_echo, calcHash, markFirstChar, markAllChars, toNum, scannSource, postValue, get_browser_name, DropDown, infoLabl, menuCapt, menuButt.