What is Page Objects?Page Objects is a framework used to build dynamic web applications based on PHP. The primary goal of Page Objects is to provide a strong separation between the application PHP code and the browser HTML/CSS code. This strong separation makes it possible to make changes to the front end or back end of a site without risking damage or unexpected changes that can occur when the code for the back end and front end are mixed together in the same source files.
This separation of code is accomplished through the implementation of page views and page objects. A page view will include object tags in the HTML/CSS that will execute an instance of a PHP object as the page is created on the server. This object execution may perform some back end function such as setting session variables or storing content in a database table or it may return some content to be used within the page.
As an example we can consider the viewurl object that returns an absolute URL to the specified application view. If we want the absolute URL to the help view then this object is loaded into a page using the following tag in the HTML view...
This object tag in a view will produce the following results...
The result is the absolute URL for the application's help view. If this application were moved to a new domain or sub-directory and the configuration adjusted to the new location this view would automatically produce the correct absolute URL using the page object.