Start page

Mykola Zharkikh (Kyiv)

Personal site

?

Page object

Object Page designed for generating HTML code of th web pages based on data that provide node (object Node). This class is inherited from the SmerecashPage class and is a significant expansion of the latter. Object has no special constructor, for its correct creation function CreatePage must be called.

function CreatePage($Node, $Mode = NULL)

This function creates an autonomous Page object based on information from the parameter-object $Node. Optional $Mode parameter sets the mode for which Page object will generate the code. Typically this view mode, but can also generate code for editing mode, search mode, statistics mode, etc.

Fields

protected $MetaData – meta information for the page.

public $Lang – language version, for which the HTML code generated.

public $Node – node that provides data to generate HTML code.

protected function Add2Smerecach($HTML, $LastUpd)

Method writes the HTML code of page passed in parameter $HTML, in smerecash to next reuse code. The $LastUpd parameter contain last modification date for code in the ISO format.

protected function CanSmerecashe()

The method returns a Boolean value, which allows or denies smerecashing for this page. It calls method of the superclass and then further checks attribute Smerecasheable for the node.

public function CompiledAttr($Params = NULL)

The method performs compilation of smeretags. $Params – associative array of parameters from which this method uses only parameter AttrName – attribute name that must be compiled. If this parameter is omitted, HTMLCode assumed.

protected function CreateDataset()

The method returns an array of parameters that would pass to the Tree object to generate a visual tree hierarchy browser. Classes-descendants may override this method to generate a specific document tree instead of a full site tree according to their tasks.

public function Display($AsString = False)

This method overrides the method of superclass. It performs the following actions:

  • call method OnDisplay() – an event handler for page generation, which can carry more data preparation;
  • call method HTMLString(), which generates the HTML code of the document;
  • calculates the modification date;
  • examine the possibility of document smerecashing (CanSmerecashe()) and for its positive response add it to smerecash (Add2Smerecach());
  • sends the document to the client (SendPage())

protected function HTMLString()

The method generates HTML code document: downloading the desired language version of the page template, compiles smeretags presented in the template and executes substitution of other elements of HTML code.

public function Inspector($Params = NULL)

The method generates a visual tree of documents. An array of parameters passed as $Params, combined with an array generated by CreateDataset(). Then object of the Tree class created, which generates HTML code of the tree based on an array of parameters.

protected function LangAwareString($StrId, $Lang = NULL)

The method returns the language-dependent string which is identified by language-independent string $StrId for language $Lang (or the current language, if the latter option is not specified). The result of it the same as the LAString function call.

protected function OnDisplay()

The method is called at the beginning of the generation of HTML code and is actually a handler for the event. In this class it does nothing.

public function SetMetaData($Value)

The method sets the metadata for this item.