Prints a Javascript alert command
static
void
alert
(string $msg)
-
string
$msg: Alert message
Builds an anchor tag
Examples:
HtmlUtils::anchor('javascript:;', 'Link', 'Link', '', array('onclick'=>
'doSomething();'));
static
string
anchor
(string $url, string $text, [string $statusBarText = ''], [string $cssClass = ''], [array $jsEvents = array()], [string $target = ''], [string $name = ''], [string $id = ''], [string $rel = ''], [string $accessKey = ''])
-
string
$url: Target URL
-
string
$text: Caption text
-
string
$statusBarText: Status bar text (appears upon onmouseover)
-
string
$cssClass: CSS class
-
array
$jsEvents: Hashmap of JS event listeners
-
string
$target: Target frame or window
-
string
$name: Anchor name
-
string
$id: Anchor ID
-
string
$rel: Relathionship between the current document and the target document
-
string
$accessKey: Access key
Builds a BUTTON tag
Examples:
HtmlUtils::button('BUTTON', 'btnBack', 'Back', "onclick='history.back();'");
static
string
button
([string $type = 'SUBMIT'], [string $id = ''], [string $value = ''], [string $script = ''], [string $alt = ''], [string $cssClass = ''], [string $accessKey = ''])
-
string
$type: Button type
-
string
$id: Button ID
-
string
$value: Button value
-
string
$script: JS event listeners
-
string
$alt: Alternate text
-
string
$cssClass: CSS class
-
string
$accessKey: Access key
Prints JS code to close the current browser window
static
void
closeWindow
()
Surrounds a given text with an HTML tag with color specification
Examples:
static
string
colorize
(string $text, string $color, [string $tagName = 'span'])
-
string
$text: Text
-
string
$color: Color specification (name or RGB string)
-
string
$tagName: Tag name
Prints a Javascript confirm command
static
void
confirm
(string $msg, [string $trueAction = ''], [string $falseAction = ''])
-
string
$msg: Dialog message
-
string
$trueAction: Ok action
-
string
$falseAction: Cancel action
Builds the HTML code a list of terms and definitions
static
string
definitionList
(array $values, [string $listAttr = ''], [string $termAttr = ''], [string $defAttr = ''])
-
array
$values: Hash array of terms and definitions
-
string
$listAttr: Attributes of the list
-
string
$termAttr: Attributes for all terms
-
string
$defAttr: Attributes for all definitions
Builds the HTML code of an embedded flash movie
static
string
flashMovie
(string $src, [int $wid = 0], [int $hei = 0], [array $vars = array()], [bool $transparent = FALSE])
-
string
$src: SWF path
-
int
$wid: Movie width
-
int
$hei: Movie height
-
array
$vars: Movie variables
-
bool
$transparent: Transparent flag
Builds JS code that requests focus to a given form or form input
static
mixed
focus
(string $form, string $field, [string $object = ''], [bool $return = FALSE])
-
string
$form: Form name
-
string
$field: Field name
-
string
$object: Base document
-
bool
$return: Whether the code should be returned or printed
Prints JS code to go back N positions based on browser history
static
void
goBackN
([int $n = 1])
-
int
$n: Number of positions
Builds an IMG tag
Examples:
// image path only
// inline dimensions
// id and swap image
HtmlUtils::image('images/button_off.gif', '', 0, 0, -
1, -
1, '', 'btnId', 'images/button_on.gif');
static
string
image
(string $src, [string $alt = ''], [int $wid = 0], [int $hei = 0], [int $hspace = -1], [int $vspace = -1], [string $align = ''], [string $id = ''], [string $swpImage = ''], [string $cssClass = ''])
-
string
$src: Image path
-
string
$alt: Alternate text
-
int
$wid: Image width
-
int
$hei: Image height
-
int
$hspace: Horizontal spacing
-
int
$vspace: Vertical spacing
-
string
$align: Image align
-
string
$id: Image ID
-
string
$swpImage: Swap image path
-
string
$cssClass: CSS class
Builds the HTML code of a list of items, using OL or UL tags
static
string
itemList
(array $values, [bool $ordered = FALSE], [string $listAttr = ''], [string $itemAttr = ''])
-
array
$values: List elements
-
bool
$ordered: Whether to render an ordered (OL) or an unordered (UL) list
-
string
$listAttr: Attributes of the list
-
string
$itemAttr: Attributes for all list items
Builds a "mailto:" anchor
Optionally, the email address can be obfuscated to prevent against spammers.
Examples:
static
string
mailtoAnchor
(string $email, [string $text = ''], [string $statusBarText = ''], [string $cssClass = ''], [string $id = ''], [bool $obfuscate = TRUE])
-
string
$email: E-mail address
-
string
$text: Caption text
-
string
$statusBarText: Status bar text (appears upon onmouseover)
-
string
$cssClass: CSS class
-
string
$id: Anchor ID
-
bool
$obfuscate: Whether email address should be obfuscated
Builds the HTML code of an embedded Windows Media Player movie
The supported flags are: CLIP_INFO, CLIP_STATUS, CONTROLS, AUTO_SIZE and AUTO_START.
static
string
mediaPlayerMovie
(string $src, [int $wid = 0], [int $hei = 0], [array $flags = array()])
-
string
$src: Movie path
-
int
$wid: Movie width
-
int
$hei: Movie height
-
array
$flags: Flags
Transforms new lines into
tags
static
string
newLineToBr
(string $str)
Render a sequence of no-break space chars
static
string
noBreakSpace
([int $n = 1])
Builds the HTML code of a DHTML tooltip
The tooltip is based on the overlib library. The first argument must be a valid instance of Document class.
static
string
overPopup
(
Document &$_Document,
string $caption, [
string $argumentList =
''])
-
Document
&$_Document: HTML document that will contain the tooltip
-
string
$caption: Tooltip message
-
string
$argumentList: Overlib arguments
Transforms URLs found in a given text into links
Parses the following protocols: http, https, ftp, mailto and news.
static
string
parseLinks
(string $str)
Builds the HTML code of an embedded QuickTime movie
The supported flags are: CACHE, CONTROLS, LOOP, AUTO_START and AUTO_SIZE.
static
string
quickTimeMovie
(string $src, [int $wid = 0], [int $hei = 0], [array $flags = array()])
-
string
$src: Movie path
-
int
$wid: Movie width
-
int
$hei: Movie height
-
array
$flags: Flags
Builds the HTML code of an embedded RealPlayer movie
Supported flags: CLIP_INFO, CLIP_STATUS, CONTROLS, AUTO_START and LOOP. Flag names are case-sensitive.
static
string
realPlayerMovie
(string $src, [int $wid = 0], [int $hei = 0], array $flags)
-
string
$src: Movie path
-
int
$wid: Movie width
-
int
$hei: Movie height
-
array
$flags: Flags
Prints JS code that redirects to another URL
static
void
redirect
(string $url, [string $object = "document"])
-
string
$url: Target URL
-
string
$object: Source document
Prints a META refresh tag
static
void
refresh
(string $url, [int $time = 1])
-
string
$url: Target URL
-
int
$time: Seconds to wait before redirection
Prints JS code that replaces the current URL by another
static
void
replace
(string $url)
Builds the HTML code of a DIV with overflow handling
static
string
scrollableArea
(string $content, int $width, int $height, [string $overflow = 'auto'], [string $cssClass = ''], [string $id = ''])
-
string
$content: Contents
-
int
$width: Width
-
int
$height: Height
-
string
$overflow: Overflow handling type
-
string
$cssClass: CSS class
-
string
$id: ID
Renders code that shows a message in the browser's status bar
static
mixed
statusBar
(string $str, [bool $return = TRUE])
-
string
$str: Message
-
bool
$return: Whether the generated code should be returned or printed
Builds the HTML code of a table, based on a given array
Example:
$table = array(array('Name' => 'Foo'), array('Name' => 'Bar'), array('Name' => 'Baz'));
print
HtmlUtils::table($table, TRUE, "", " class='odd_row'", " class='even_row'");
static
string
table
(array $table, [bool $headers = TRUE], [string $tableAttr = ''], [string $cellAttr = ''], [string $alternateCellAttr = ''], [string $headerAttr = ''])
-
array
$table: Table data
-
bool
$headers: Whether table headers should be rendered
-
string
$tableAttr: Attributes of the TABLE element
-
string
$cellAttr: Attributes for all TD elements
-
string
$alternateCellAttr: Alternating style (even/odd rows)
-
string
$headerAttr: Attributes for all TH elements
Surrounds a text with a given tag N times
Example:
// prints <big><big>Hello World!</big></big>
static
string
tagRepeat
(string $tag, string $content, [int $n = 1])
-
string
$tag: Tag name
-
string
$content: Tag contents
-
int
$n: How many times $tag must be rendered
Builds a call to the Window.open JS function
Example:
$link =
HtmlUtils::anchor('javascript:;', 'Open me', 'Open me', '', array('onclick'=>
$window));
static
string
window
(string $url, [int $windowType = 255], [int $windowWidth = 640], [int $windowHeight = 480], [int $windowX = 0], [int $windowY = 0], [string $windowTitle = ''], [bool $windowReturn = FALSE])
-
string
$url: Window URL
-
int
$windowType: Window type (bitmap of chrome properties)
-
int
$windowWidth: Window width
-
int
$windowHeight: Window height
-
int
$windowX: Window X position
-
int
$windowY: Window Y position
-
string
$windowTitle: Window title
-
bool
$windowReturn: Whether to return the window object
Inherited Methods
Inherited From PHP2Go
PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()