putThemeContent Method

The putThemeContent method used for load a view component file in current theme. This method support stack for loading another view component.

Basic Usage

Here is the basic usage of putThemeContent method from SENE_Controller class.

$this->putThemeContent(string $content_location[, array $data]): $this


This method has required 1 parameter that is $content_location.


The $content_location value can be a string that indicates view component location related to current theme. This value does not need .php suffix.


The $data values contain array of array that will be passed to view as a variable. The array key from this value will be parsed as name of a variable.


Here is the example implementation of putThemeContent method.

File and Directory structures

Before implementing the codes, we have to understand the file and directory structure that will used in example.

└── view/
 └── front/
  ├──  home/
  | ├──  slider.php
  | └──  three_values.php
  └──  page
    └──  col-1.php

The Controller

On this code example shows implementation of putThemeContent method and how to passing variable to it.

class Home extends SENE_Controller
  public function __construct()
  public function index()
    $data = array();
    $data['example'] = 'this is example';

View component

From this example, how view called $data as a variable on home/slider.php view component source codes.

  <h1>This is parsed value from data <?=$example?></h1>


The putThemeContent , putJsContent and loadLayout methods has the ability to buffer view components. So the view component(s) that collected from the methods are not directly show up on browser, but only displayed while called render method.