PHP Classes

File: application/helpers/menu_helper.php

Recommend this page to a friend!
  Classes of Muhammad Yahya   PPDB Prediksi   application/helpers/menu_helper.php   Download  
File: application/helpers/menu_helper.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PPDB Prediksi
Application to manage schools in Indonesia
Author: By
Last change:
Date: 2 years ago
Size: 624 bytes
 

Contents

Class file image Download
<?php
if (!function_exists('active_link')) {
    function
active_menu($controller)
    {
       
$CI = get_instance();
       
$class = $CI->router->fetch_class();
        return (
$class == $controller) ? 'active' : '';
    }
}

if ( !
function_exists('getData')) {
  function
getData($tableName, $columns = '*', $where = [])
  {
     
$ci =& get_instance();
     
$sql = "SELECT $columns FROM $tableName";

      if (
count($where) !== 0) {
         
$key = array_keys($where)[0];
         
$val = array_values($where)[0];
         
$sql .= " WHERE $key = '$val'";
      }

      return
$ci->db->query($sql)->result();
  }
}