OC_Template

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

Properties

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

Methods

public OC_Template::__construct($app, $name, $renderAs=\OCP\AppFramework\Http\TemplateResponse::RENDER_AS_BLANK, $registerCall=\true)
Constructor
Source:

lib/private/legacy/OC_Template.php#76

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/OC_Template.php#102

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

lib/private/legacy/OC_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/OC_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/OC_Template.php#179
Returns: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/OC_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=[])
Shortcut to print a simple page for users
Source:

lib/private/legacy/OC_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=[])
Shortcut to print a simple page for admins
Source:

lib/private/legacy/OC_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=[])
Shortcut to print a simple page for guests
Source:

lib/private/legacy/OC_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/OC_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/OC_Template.php#318

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

bool | string