Child pages
  • cHTML
Skip to end of metadata
Go to start of metadata


CONTENIDO provides the feature to build html code in your php script with the use of objects. So it is possible to generate valid markup without writing the code by yourself.

The big advantage of such a central functionality is that the changes at one place effect all other usages, for example to set a default attribut in the whole CONTENIDO markup. Because of these potential it is highly recommended to use the cHTML classes to build your html code.


The central element is the cHTML class with the elementary features to generate valid html tags including content, attributes.

The cHtml class provides to set ids automatically. The Ids will be in the format 'm1', the number will be incremented for every new instance. If you don´t want to use this feature it is possible to set the id manually with the public method setID(id).

At the first inheritance level are the classes cHTMLFormElement, cHTMLContentElement, cHTMLIframe and cHTMLImage.

Complete class diagramm:






Adds a required script to the current element.Scripts are not included twice.


generate a unique id.

appendStyleDefinition($property, $value)

Appends the given style definition to the HTML element.
appendStyleDefinitions(array $styles)Appends the given style definitions to the HTML element.
attachEventDefinition($name, $event, $code)Attaches the code for an event.
display()Outputs the generated markup.
getAttribute($attributeName)Returns the value of the given attribute.
getAttributes($returnAsString = false)Returns the assoc array(default) or string of attributes
getID()Returns the current ID.
removeAttribute($attributeName)Removes an attribute.
render()Alias for toHtml.
setAlt($alt, $setTitle = true)Sets the alt and title attributes.
setAttribute($attributeName, $value = NULL)Sets a specific attribute.
setAttributes(array $attributes)Sets the HTML attributes.
setClass($class)Sets the CSS class.

setEvent($event, $action)

Adds an "on..." javascript event handler.
setGenerateXHTML($value)Setter for static $_generateXHTML property.
setID($id)Sets the ID class.
setStyle($style)Sets the CSS style.
setTag($tag)Sets the HTML tag.
toHTML()Generates the markup of the element.
unsetEvent($event)Removes an event handler.
updateAttribute($name, $value)

Updates the passed attribute without changing the other existing attributes.

updateAttributes(array $attributes)

Updates the passed attributes without changing the other existing attributes.


The cHTMLFormElement class represents a form element. All the inheritanced classes are logically grouped by the form context.

Specified elements:



HTML element


The cHTMLButton class represents a button.
cHTMLCheckboxcHTMLCheckbox class represents a checkbox.
<input type="checkbox" />
cHTMLHiddenFieldcHTMLHiddenField class represents a hidden form field.
<input type="hidden" />
cHTMLOptionElementcHTMLOptionElement class represents a select option element.
cHTMLPasswordboxcHTMLPasswordbox class represents a password form field.
<input type="password" />
cHTMLRadiobuttoncHTMLRadiobutton class represents a radio button.
<input type="radio" />
cHTMLSelectElementcHTMLSelectElement class represents a select element.
cHTMLTextareacHTMLTextarea class represents a textarea.
cHTMLTextboxcHTMLTextbox class represents a textbox.
<input type="text" />
cHTMLUploadcHTMLUpload class represents a file upload element.
<input type="file" />


The cHTMLContentElement class represents a content element.

cHTMLCanvas cHTMLCanvas class can be used for creating graphics.
cHTMLDiv cHTMLDiv class represents a div element.
cHTMLFieldset cHTMLFieldset class represents a fieldset element.
cHTMLFooter HTMLFooter class represents a footer.
cHTMLForm cHTMLForm class represents a form.
cHTMLHeader cHTMLHeader class represents a header.
cHTMLHgroup cHTMLHgroup class represents a set of related headlines.
cHTMLLabel cHTMLLabel class represents a form label.
cHTMLLegend cHTMLLegend class represents a legend element.
cHTMLLink cHTMLLink class represents a link.
cHTMLList cHTMLList class represents a list.
<ul></ul>, <ol></ol>
cHTMLListItem cHTMLListItem class represents a list item.
cHTMLNav cHTMLNav class represents a navigation.
cHTMLOptgroup cHTMLOptgroup class can be used for creating optgrops.
cHTMLParagraph cHTMLParagraph class represents a paragraph.
cHTMLScript cHTMLScript class represents a script.
cHTMLSection cHTMLSection class represents a section within an article.
cHTMLSpan cHTMLSpan class represents a span element.
cHTMLTable cHTMLTable class represents a table.
cHTMLTableBody cHTMLTableBody class represents a table body.
cHTMLTableData cHTMLTableData class represents a table date.
cHTMLTableHeader cHTMLTableHead class represents a table head.
cHTMLTime cHTMLTime class represents a date/time.
cHTMLVideo cHTMLVideo class represents a video.



The cHTMLIFrame class represents an iframe.


setSrc(string $src)This method sets the source of the iframe.
setWidth(string $width)This method sets the width of the iframe.
setHeight(string $height)This method sets the height of the iframe.
setBorder(string $border)This method sets the border of the iframe.


The cHTMLImage class represents an image.

setSrc(string $src)This method sets the source of the image.
setWidth(string $width)This method sets the width of the image.
setHeight(string $height)This method sets the height of the image.
setBorder(string $border)This method sets the border of the image.