Call to undefined function title()

header.php

<title><?= title(); ?></title>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <!--     Fonts and icons     -->
  <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:700,900|Roboto+Slab:400,700|Material+Icons" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css">
  <!-- Material Kit CSS -->
  <link href="<?= get_template_directory(dirname(__FILE__), 'assets/css/material-kit.css'); ?>" rel="stylesheet" />
  <link href="<?= get_template_directory(dirname(__FILE__), 'assets/css/material-kit.min.css');?>" rel="stylesheet" />

template_helper.php

function title() {
    $_this =& get_instance();
    global $SConfig;

    $array_backend_page = array(
      'home' => 'Home',
      'raport' => 'Raport'
     );

    $title = NULL;
    if ($_this->site->side == 'backend' && (array_key_exists($_this->uri->segment(2), $array_backend_page))) {
      return $array_backend_page[$_this->uri->segment(2)] . ' | ' . $SConfig->_cms_name;
    }
  }
}

MY_Controller.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class MY_Controller extends CI_Controller {

  public $data = array();

  function __construct() {
    parent::__construct();

    $this->load->helper(array('template_helper'));
    $this->load->library(array('Site'));
    $this->load->model(array());
  }
}

pesan errornya

Call to undefined function title() //pada bagian header.php

Padahal helpernya sudah saya load

avatar kautsarteguh
@kautsarteguh

21 Kontribusi 2 Poin

Diperbarui 4 tahun yang lalu

2 Jawaban:

header.php di panggil di controller mana ?

avatar Rozul
@Rozul

44 Kontribusi 20 Poin

Dipost 4 tahun yang lalu

sudah ketemu jawabannya, ternyata salah letak tanda "{}".

avatar kautsarteguh
@kautsarteguh

21 Kontribusi 2 Poin

Dipost 4 tahun yang lalu

Tanggapan

Jangan lupa untuk merubah status thread ini menjadi solve, Tetap semangat

Login untuk ikut Jawaban