PTemplate

The class PTemplate maps templates. This object is derived from > PView > PObject.

Fields:
TemplateName, String
TemplateType, Integer
TemplateValue, String
function PTemplate ($sTemplate="") [CONSTRUCTOR]
The constructor calls the ancestor’s constructor. In so far as the parameter $sTemplate is passed, the template named $sTemplate is loaded. If no parameter is passed or no template is found, you can apply a new template with the Create-Object function.

function Create ($sTemplateName)
Applies a new template to the Portalsuite data base under the name passed in the parameter $sTemplateName. If this could be done successfully, the object continues to map this new template. It is useful to call the object function WriteField afterwards in order to define the value settings for the different fields.

function Delete ()
Deletes the template in the Portalsuite data base, which represents the object.

function Field ($sFieldName)
Reads out the passed field $sFieldName and returns the field content.

function GetTemplateName ()
Returns the template’s name, in so far as the object represents a valid dataset in the Portalsuite data base. Internally it solely calls the internal object function Field.

function GetTemplateType ()
Returns the template’s type, in so far as the object represents a valid dataset in the Portalsuite data base. Internally it solely calls the internal object function Field. For the type identification the following PHP constants are defined:
- PS_TemplateType_normal (Normal standard template)
- PS_TemplateType_overview (overview template)
- PS_TemplateType_articleview (view article template)
- PS_TemplateType_mail (e-mail template)
- PS_TemplateType_mikro (micro template)

function Output ($sVariables="")
If the current template is valid, at first the internal object function ParseTemplateIncludes is called, which includes all sub-templates. In so far as the global flag for the execution of the downwards compatible Portalsuite 2001 template code interpreter (TCI) is set in the base setup, at first the Portalsuite 2001 template code commands are parsed through the TCI. Afterwards the template is written out – herewith the contained PHP code is executed.

function ParseTemplateIncludes ()
This internal function returns the current template together with all included sub-templates in one assembled string, in so far as the object maps a valid dataset in the Portalsuite data base. This function is internally called by the object function Output.

function Valid ()
Checks if the current object is valid (return value =1) or non-valid (return value=0). The object is valid if it represents a template in the Portalsuite data base. The function Valid is called by other object functions a. o.

function WriteField ($sFieldName,$sFieldValue)
Writes the passed content of the variable $sFieldValue into the field, which is defined by the parameter $sFieldName.