putJsContent Method

This method will be loaded a theme with javascript content from a theme file.

The $content_location value will be referred to a file name under app/view/THEME/.

This value also can contain path prefix of subdirectory before the filename.

Basic Usage

Here is the basic usage of putThemeContent method from SENE_Controller .

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

Parameter

Metode ini memiliki 1 paremeter wajib yaitu $content_location.

$content_location

The $content_location value is a string indicates view component locations from current theme. This location value does not require .php suffix.

$data

The $data value contains about array of array that passed to view. The array key will be parsed as native variable(s) on view.

Example

Here is the example for putThemeContent method:

class Home extends SENE_Controller
{
  public function __construct()
  {
    parent::__construct();
    $this->setTheme('homepage');
  }
  public function index()
  {
    $data = array();
    $this->putThemeContent('home/slider',$data);
    $this->putThemeContent('home/three_values',$data);
    $this->putJsContent('home/home_bottom',$data);
    $this->loadLayout('col-1',$data);
  }
}

So, the homepage theme, col-1 layout and home_bottom.php content should be existed on the directory structure.

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

Example home_bottom.php content

Here is the example code for home_bottom.php content

alert('Hi, this is from home_bottom');