OC_Template

class OC_Template
This class provides the templates for ownCloud.
Source:lib/private/legacy/template.php#47
Parent:OC\Template\Base

Properties

protected static property OC_Template::$app
Source:lib/private/legacy/template.php#59
Type:string
protected property OC_Template::$initTemplateEngineFirstRun
Source:lib/private/legacy/template.php#61

Methods

public OC_Template::__construct($app, $name, $renderAs="", $registerCall=\true)
Constructor
Source:

lib/private/legacy/template.php#74

Parameters:
  • $app (string) app providing the template
  • $name (string) of the template file (without suffix)
  • $renderAs (string) If $renderAs is set, OC_Template will try to

produce a full page in the according layout. For now, $renderAs can be set to “guest”, “user” or “admin”. * $registerCall (bool) = true

public static OC_Template::initTemplateEngine($renderAs)
Source:

lib/private/legacy/template.php#100

Parameters:
  • $renderAs (string)
protected OC_Template::findTemplate($theme, $app, $name)
find the template with the given name
Source:

lib/private/legacy/template.php#144

Parameters:
  • $theme (string)
  • $app (string)
  • $name (string) of the template file (without suffix)

Will select the template file for the selected theme. Checking all the possible locations.

Returns:

string[]

public OC_Template::addHeader($tag, $attributes, $text=\null)
Add a custom element to the header
Source:

lib/private/legacy/template.php#164

Parameters:
  • $tag (string) tag name of the element
  • $attributes (array) array of attributes for the element
  • $text (string) the text content for the element. If $text is null then the

element will be written as empty element. So use “” to get a closing tag.

public OC_Template::fetchPage($additionalParams=\null)
Process the template
Source:lib/private/legacy/template.php#179
Returns:bool | string This function process the template. If $this->renderAs is set, it will produce a full page.
public OC_Template::inc($file, $additionalParams=\null)
Include template
Source:

lib/private/legacy/template.php#227

Parameters:
  • $file (string)
  • $additionalParams (array | null)
Returns:

string returns content of included template

Includes another template. use <?php echo $this->inc(‘template’); ?> to do this.

public static OC_Template::printUserPage($application, $name, $parameters=array())
Shortcut to print a simple page for users
Source:

lib/private/legacy/template.php#238

Parameters:
  • $application (string) The application we render the template for
  • $name (string) Name of the template
  • $parameters (array) Parameters for the template
Returns:

bool | null

public static OC_Template::printAdminPage($application, $name, $parameters=array())
Shortcut to print a simple page for admins
Source:

lib/private/legacy/template.php#253

Parameters:
  • $application (string) The application we render the template for
  • $name (string) Name of the template
  • $parameters (array) Parameters for the template
Returns:

bool

public static OC_Template::printGuestPage($application, $name, $parameters=array())
Shortcut to print a simple page for guests
Source:

lib/private/legacy/template.php#268

Parameters:
  • $application (string) The application we render the template for
  • $name (string) Name of the template
  • $parameters (array | string) Parameters for the template
Returns:

bool

public static OC_Template::printErrorPage($error_msg, $hint="", $statusCode=500)
Print a fatal error page and terminates the script
Source:

lib/private/legacy/template.php#283

Parameters:
  • $error_msg (string) The error message to show
  • $hint (string) An optional hint message - needs to be properly escape
  • $statusCode (int)
public static OC_Template::printExceptionErrorPage($exception, $statusCode=503)
print error page using Exception details
Source:

lib/private/legacy/template.php#318

Parameters:
  • $exception (Exception | \Throwable)
  • $statusCode (int)
Returns:

bool | string