CodeIgniter Forums
A link in a generated table - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: A link in a generated table (/showthread.php?tid=69342)

A link in a generated table - FARUKB13 - 11-07-2017

Hi guys,

How do I make a link in a generated table? I want the first row called 'Campagne' and the fourth row called 'Terugbellers' to be a link. But how? Thanks in advance.

My code:

PHP Code:
public function belbestandQuery(){

      $database $this->verversBelbestand();
      if($database == null){
      $database 'secret';
      } else {

        $config['hostname'] = 'secret';
        $config['username'] = 'secret';
        $config['password'] = 'secret';
        $config['database'] = $database;
        $config['dbdriver'] = 'sqlsrv';
        $config['dbprefix'] = '';
        $config['pconnect'] = FALSE;
        $config['db_debug'] = TRUE;
        $config['cache_on'] = FALSE;
        $config['cachedir'] = '';
        $config['char_set'] = 'utf8';
        $config['dbcollat'] = 'utf8_general_ci';

        $this->customDb $this->load->database($configtrue);


        $campagne '';
        $datum date("Y/m/d");
        $bmnrlic $this->getBmnrLicentie();

$this->table->set_heading('Campagne ''Aantal agenten''Nog benaderbaar''Terugbellers''Nog na te kijken''BMNR uitgesloten''Geparkeerd''Maxbeldatum');

$objquery $this->customDb->query("Aantallen_datum_intranet '".$campagne."','".$datum."','".$bmnrlic."'");

$template = array(
        'table_open'            => '<table border="1" cellpadding="4" cellspacing="0">',

        'thead_open'            => '<thead>',
        'thead_close'           => '</thead>',

        'heading_row_start'     => '<tr>',
        'heading_row_end'       => '</tr>',
        'heading_cell_start'    => '<th>',
        'heading_cell_end'      => '</th>',

        'tbody_open'            => '<tbody>',
        'tbody_close'           => '</tbody>',

        'row_start'             => '<tr>',
        'row_end'               => '</tr>',

        'cell_start'            => '<td>',
        'cell_end'              => '</td>',

        'row_alt_start'         => '<tr>',
        'row_alt_end'           => '</tr>',
        'cell_alt_start'        => '<td>',
        'cell_alt_end'          => '</td>',

        'table_close'           => '</table>'



RE: A link in a generated table - InsiteFX - 11-07-2017

You will need to re-write some of this but you should get the idea.

PHP Code:
public function manage()
// Grab an array of users from the database
$data $this->users->users();

// Set headings for this table

$data as $value => $key)
// Build actions links
$actions anchor("admin/users/edit/".$key['id']."/""Edit").

// Add the new row to the table
$this->table->add_row($key['username'], $key['email'], $actions);

// Load the view

Any way that's how I do it, hope it helps you out.

You still need the table template, I place that in the constructor of a MY_Controller.