Welcome Guest, Not a member yet? Register   Sign In
Parser and array. Please help!
#1

[eluser]Unknown[/eluser]
Hi everyone! I have a little trouble with CI template parser.
I have a library, which gets data from a servers. How it works: i'm sent array with data to the library and library returns to me array with server settings. It looks like:


Im prepare to request and parse data

Code:
public function index()
{
    
       $this->load->library('parser');
       $this->load->model('serverlist_m'); //get data from database
      
       $result = $this->serverlist_m->get_entries('servers', 10);    
      
        foreach($result as $row) // prepare to put data in array
        {
            
            $servers = array(
          array(
           'id' => $row->id,
           'type' => 'cs16',
           'host' => $row->address,
          )
         );
            
         $results = $request->requestData();  
        
        

// preparing sending data to parser
         $replace = array(      
        'content' => $results,  
        );



        }


===================================
$replace contains:

Array
(
    [content] => Array
        (
            [1] => Array // ID
                (
                    [address] => 127.0.0.1:27080
                    [antidlfile_version] => 1.4
                    [dedicated] => d
                    [edgefriction] => 2
);

AFTER this, im using in the view {content}{variable_from_array}{/content}.

So... my question: how i can call ID in view with braces (like {1}...?)? Or insert variable into array...
In this case:
Code:
[1] => Array

I really stuck on this...

P.S. Sorry for my english!




Theme © iAndrew 2016 - Forum software by © MyBB