setTheme Method

The setTheme method purpose is for set a theme view for current controller.

Basic Usage

Here is the basic usage of setTheme method from SENE_Controller .

setTheme(string $theme_name): $this

Parameters

setTheme requires 1 parameter it is $theme_name.

$theme_name

The $theme_name value can be a directory name under app/view, learn more about view theme .

Theme Name Requirements

The valid themes should contain these files with this directory structure.

|app/
└── view/
 └── [THEME_NAME]/
  ├── theme.json
  ├── script.json
  └── page/
   └── col-1.php

Example

Here is the example for setTheme method.

class Home extends SENE_Controller
{
  public function __construct()
  {
    parent::__construct();
    $this->setTheme('homepage');
  }
  public function index()
  {
    ...
  }
}

So, the directory homepage should be existed on the directory structure.

| app/
|- view/
|-- homepage/
|--- theme.json
|--- script.json
|--- page/
|----- col-1.php