putJsContent Method

SENE_Controller::putJsContent digunakan untuk memanggil isi dari file javascript kedalam template html.

Supaya dapat berjalan dengan baik, metode ini membutuhkan getJsContent() yang diapit didalam tag script.

Penggunaan dasar

Berikut ini adalah contoh pengunaan dari methode putJsContent.

SENE_Controllers::putJsContent(string $js_location[, array $data]): object SENE_Controller

Contoh Penggunaan lengkap

Here is the example for putThemeContent method:

<?php
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
|--- homepage
|---- 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');