Welcome Guest, Not a member yet? Register   Sign In
Multi-line cell content in CLI::table()
#1
Information 

Code:
+----+--------------------------+---------------------+--------+
| ID | Title                    | Updated At          | Active |
+----+--------------------------+---------------------+--------+
| 7  | A great item title       | 2017-11-16 10:35:02 | 1      |
| 8  | Another great item title | 2017-11-16 13:46:54 | 0      |
+----+--------------------------+---------------------+--------+

I want do add an additional "row" in the "Updated at" cell. How would I do that with CLI::table()?

I've tried adding a "\n" followed by the additional content, but that screws up the entire table layout...

-joho
Reply
#2

your code so we can process here
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#3

(This post was last modified: 02-03-2025, 01:20 AM by joho.)

(01-31-2025, 10:01 AM)luckmoshy Wrote: your code so we can process here


What I have:

Code:
        $thead = ['Site ID', 'Disabled', 'Fail' , 'Site name', 'Owner'];
        $tbody = [];
        foreach( $list_sites as $k => $site ) {
            $tbody[] = [
                $site['site_recno'],
                ( $site['site_is_disabled'] ? 'Yes':'No' ),
                $site['site_fail_count'],
                $site['site_name'], $site['site_owner'],
            ];
        }// foreach
        CLI::table( $tbody, $thead );
What I tried:

Code:
      $thead = ['Site ID', 'Disabled', 'Fail' , 'Site name / Owner'];
        $tbody = [];
        foreach( $list_sites as $k => $site ) {
            $tbody[] = [
                $site['site_recno'],
                ( $site['site_is_disabled'] ? 'Yes':'No' ),
                $site['site_fail_count'], $site['site_name'] . "\n" . $site['site_owner'],
            ];
        }// foreach
        CLI::table( $tbody, $thead );

-joho
Reply




Theme © iAndrew 2016 - Forum software by © MyBB