Overview

Packages

  • Jyxo_Beholder
  • Jyxo_Charset
  • Jyxo_Color
  • Jyxo_Css
  • Jyxo_ErrorHandling
  • Jyxo_FirePhp
  • Jyxo_Gettext
    • Parser
  • Jyxo_Html
  • Jyxo_Input
    • Chain
    • Filter
    • Validator
  • Jyxo_Mail
    • Email
    • Parser
    • Sender
  • Jyxo_Rpc
    • Json
    • Xml
  • Jyxo_Shell
  • Jyxo_SpamFilter
  • Jyxo_Spl
  • Jyxo_String
  • Jyxo_Svn
  • Jyxo_Time
  • Jyxo_Timer
  • Jyxo_Webdav
  • Jyxo_XmlReader
  • PHP

Classes

  • Jyxo_Html
  • Jyxo_HtmlTag
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Class Jyxo_HtmlTag

Class for generating (x)HTML source code. Allows creating HTML tags and its attributes.

Example:

$p = Jyxo_HtmlTag::create('p')->setClass('buttons');

The magic __call() method ensures attributes settings.

$p->render();

The render() method creates the HTML output.

Final
Category: Jyxo
Package: Jyxo_Html
Copyright: Copyright (c) 2005-2011 Jyxo, s.r.o.
License: https://github.com/jyxo/php/blob/master/license.txt
Author: Roman Řáha
Author: Štěpán Svoboda
Located at HtmlTag.php
Methods summary
public static Jyxo_HtmlTag
# create( string $tag )

Creates an element instance.

Creates an element instance.

Parameters

$tag
string
HTML element name

Returns

Jyxo_HtmlTag
public static Jyxo_HtmlTag
# createFromSource( string $html )

Returns an element instance from the given source. The first and last tag will be used as the opening and closing tag respectively. Anything between those tags will be used as contents.

Returns an element instance from the given source. The first and last tag will be used as the opening and closing tag respectively. Anything between those tags will be used as contents.

Parameters

$html
string
HTML source code

Returns

Jyxo_HtmlTag

Throws

InvalidArgumentException
If an invalid HTML source was given
public string
# open( )

Creates and returns the opening tag.

Creates and returns the opening tag.

Returns

string
public string
# content( )

Creates and returns element's contents.

Creates and returns element's contents.

Returns

string
public string
# close( )

Creates and returns the closing tag.

Creates and returns the closing tag.

Returns

string
public string
# render( )

Renders the element.

Renders the element.

Returns

string
public Jyxo_HtmlTag
# addChild( Jyxo_HtmlTag $element )

Adds a child element.

Adds a child element.

Parameters

$element
Jyxo_HtmlTag
Child element to be added

Returns

Jyxo_HtmlTag
public Jyxo_HtmlTag
# addChildren( array $elements )

Adds multiple child elements.

Adds multiple child elements.

Parameters

$elements
array
Array of child elements

Returns

Jyxo_HtmlTag
public Jyxo_HtmlTag
# setAttributes( array $attributes )

Imports attributes from the given array.

Imports attributes from the given array.

Parameters

$attributes
array
Associative array of attributes and their values

Returns

Jyxo_HtmlTag
public Jyxo_HtmlTag
# setNoEncode( string $attribute )

Sets an attribute to not be espaced on output.

Sets an attribute to not be espaced on output.

Parameters

$attribute
string
Attribute name

Returns

Jyxo_HtmlTag
public Jyxo_HtmlTag
# setContentOnly( boolean $contentOnly )

Sets if only the contents should be rendered.

Sets if only the contents should be rendered.

Parameters

$contentOnly
boolean
Should only the contents be rendered

Returns

Jyxo_HtmlTag
public string
# __toString( )

Renders the HTML element.

Renders the HTML element.

Returns

string
public mixed
# __call( string $method, array $args )

Sets or returns the attribute.

Sets or returns the attribute.

Parameters

$method
string
Method name
$args
array
Method attributes

Returns

mixed
string|Jyxo_HtmlTag
public mixed
# __get( string $name )

Returns an attribute value.

Returns an attribute value.

Parameters

$name
string
Attribute name

Returns

mixed
string|null
Jyxo PHP Library API documentation generated by ApiGen 2.3.0