getThemeElement method

The getThemeElement method will echo the buffered view components that from another view component.

Basic Usage

The basic usage for getThemeElement method.

getThemeElement(string $view_location [,array $__forward=array() [, int $cacheable=0]]): $this

Parameters

There is 2 requireds parameter and 1 optional parameter.

$view_location

Location relatives to a theme and file name of view without .php suffix.

$__forward

Data that will be passed to buffered view component.

$cacheable

This parameter value allowed the buffered view cached with expected time value in second(s).

Example Usage

Usually this method called inside a layout file. Here is the basic example for getThemeElement method. Here is the content of col-1.php layout file.

<!DOCTYPE html>
<html>
<?php $this->getThemeElement("page/html/head",$__forward); ?>
<body>
  ...
</body>
</html>

Here is the full file and directory structures.

|- app/
|-- view/
|--- front/
|---- page/
|----- col-1.php
|----- html/
|------ head.php

Here is the source code of head.php file.

<head>
<!-- Basic page needs -->
<meta charset="utf-8">
<!-- Mobile specific metas  -->
<meta name="viewport" content="width=device-width, initial-scale=1">

<!--[if IE]>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
<![endif]-->
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title><?php echo $this->getTitle(); ?></title>
<meta name="language" content="id" />
<meta name="description" content="<?php echo $this->getDescription(); ?>"/>
<meta name="keyword" content="<?php echo $this->getKeyword(); ?>"/>
<meta name="author" content="<?php echo $this->getAuthor(); ?>">
<link rel="icon" href="<?php echo $this->getIcon(); ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getShortcutIcon(); ?>" type="image/x-icon" />
<meta name="robots" content="<?php echo $this->getRobots(); ?>" />

<?php $this->getAdditionalBefore(); ?>
<?php $this->getAdditional(); ?>
<?php $this->getAdditionalAfter(); ?>

</head>