Please help me in datatale to model page

Please help me in datatale to model page

shyriadshyriad Posts: 20Questions: 3Answers: 0

here is my code

 private function _make_active_row($data) {
   return array(($data['user']),($data['uptime']),(format_bytes($data['rx-byte'], 2)),(format_bytes($data['tx-byte'], 2)),($data['remote-address']),( modal_anchor(get_uri('clients/online_details'), "<i data-feather='tablet' class='icon-16'></i>", array("class" => "view", "title" => app_lang('clients_current_session_details'), "data-post-id" => ($data['name'])))));

 }    

// //get data for PPPOE list
    function online_details() {
         return $this->template->view("clients/online_details");
     }      

   function online_bandwidth() {    
       $API = new Mikweb(); 
       if($API->connect('192.168.88.6', 'shyriad', 'shyriad#1332')){

        $interfacetraffic = $API->comm("/interface/monitor-traffic", array(
          "interface" => "$interface",
          "once" => "",
          ));
        $rows = array(); $rows2 = array();

        $tx = $interfacetraffic[0]['tx-bits-per-second'];
        $rx = $interfacetraffic[0]['rx-bits-per-second'];

          $rows['name'] = 'Tx';
          $rows['data'][] = $tx;
          $rows2['name'] = 'Rx';
          $rows2['data'][] = $rx;

      }else{
            echo "<font color='#ff0000'>Connection Failed!!</font>";
      }

      $API->disconnect();

      $result = array();

        array_push($result,$rows);
        array_push($result,$rows2);
      print json_encode($result);
    //return  $this->template->view("clients/online_details");              
  } 

Answers

  • shyriadshyriad Posts: 20Questions: 3Answers: 0

    my "data-post-id" is ok. in browser console request data is showing but in cannot the data as $interface variable.

    please help to make $interface. If i manually write the field in $interface then the data is showing.

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    I'm afraid I don't actually understand your question. Is this about how to write a route controller in PHP? That kind of question should be directed to StackOverflow.

    Allan

  • shyriadshyriad Posts: 20Questions: 3Answers: 0

    I actually saying that after print json_encode($result);

    This Function is Not Working
    return $this->template->view("clients/online_details");

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    I'm not clear on how that is a DataTables issue? Sounds like a problem with whatever templating library you are using in PHP. You'd probably be better asking in their support forum or StackOverflow.

    Allan

  • shyriadshyriad Posts: 20Questions: 3Answers: 0

    thanks for support. i am asking in stack over flow

Sign In or Register to comment.