0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【CodeIgniter3(コードイグナイター)】のテーブルヘルパー(列数を統一して空白のtdを埋める)

Last updated at Posted at 2021-12-14
$this->load->library('table');

$table = array(
    'table_open' => '<table class = "tableLine all-center">',
);
$th = array('会員ID', '名前', '年齢');
$td = array('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight');
if(count($td)%3 > 0){
    array_push($td, '調査中');
    if(count($td)%3 === 2){
        array_push($td, '調査中');}
}

$this->table->set_template($table);
$this->table->set_heading($th);
$new_list = $this->table->make_columns($td, 3);
echo $this->table->generate($new_list);

#結果

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?