Component is base for all components specified in PXML file. Such component can represent complete view or just a one building block of it. It is used as root component of of the PXML component definition or most often as base class for such component.


  • PXML root component - only Component or it's subclass can be root component of the PXML component definition
  • universal container - Component and it's subclasses can contain any class instance as direct child, provided that it is available in the scope of the document and that it has no-argument constructor
  • named components - dynamically creates properties on on instance of itself for all components that are children or grandchildren and have attribute name set - the property name is equal to the attribute value and property value is the component on which is the attribute set
  • gives view a name - title attribute of the view when specified is used as a title of the page if the component is used to instantiate the view
  • pre-execution event - Component also dispatches preExecute event that can be used to perform various task before execution of all other events in the view goes on


Cars to sell:

CelicaToyota$ 22,000.00
IntegraHonda$ 23,000.00

Example source code

Source code of the exmaple above.

<?xml version="1.0" encoding="UTF-8"?>
<px:Component xmlns:h=""
	title="Component Example">
	<px:Array name="carList">
		<px:Object model="Celica" make="Toyota" price="22000"/>
		<px:Object model="Integra" make="Honda" price="23000"/>
	<h:p>Cars to sell:</h:p>
			<h:td>$ {number_format($self->carList[0]->price,2)}</h:td>
			<h:td>$ {number_format($self->carList[1]->price,2)}</h:td>

This example demonstrates some of the Component's features. First is that you can specify not only components in the PXML but also a more simpler types like arrays px:Array or plain object px:Object.

Another feature is specifying of the Component's title using value assigned to the attribute title.