Class CI_Table - echiong/testRepo GitHub Wiki

##Class CI_Table

HTML Table Generating Class

Lets you create tables manually or from database result objects, or arrays.

Package: [[CodeIgniter<a href="Package CodeIgniter.Libraries.md">Libraries]]
Category: HTML Tables
Author: ExpressionEngine Dev Team
Link: http://codeigniter.com/user_guide/libraries/uri.html
Located at system/libraries/Table.php

##Methods summary


public __construct ( )


public set_template ( array $template )

Set the template

Parameters

$template array


public set_heading ( )

Set the table heading

Can be passed as an array or discreet params


public make_columns ( array $array = array(), integer $col_limit = 0 )

Set columns. Takes a one-dimensional array as input and creates a multi-dimensional array with a depth equal to the number of columns. This allows a single array with many elements to be displayed in a table that has a fixed column count.

Parameters

$array array

$col_limit integer


public set_empty ( mixed $value )

Set "empty" cells

Can be passed as an array or discreet params

Parameters

$value mixed


public add_row ( )

Add a table row

Can be passed as an array or discreet params


public type _prep_args ( type $args )

Prep Args

Ensures a standard associative array format for all cell data

Parameters

$args type

Returns type


public set_caption ( string $caption )

Add a table caption

Parameters

$caption string


public string generate ( mixed $table_data = NULL )

Generate the table

Parameters

$table_data mixed

Returns string


public clear ( )

Clears the table arrays. Useful if multiple tables are being generated


public _set_from_object ( object $query )

Set table data from a database result object

Parameters

$query object


public _set_from_array ( array $data, mixed $set_heading = TRUE )

Set table data from an array

Parameters

$data array

$set_heading


public _compile_template ( )

Compile Template


public _default_template ( )

Default Template

<table class="summary" id="properties">
<caption>Properties summary</caption>
<tr data-order="rows" id="$rows">
	<td class="attributes"><code>
		public  
		array
	</code></td>

	<td class="name">

$rows

array()
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="heading" id="$heading">
	<td class="attributes"><code>
		public  
		array
	</code></td>

	<td class="name">

$heading

array()
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="auto_heading" id="$auto_heading">
	<td class="attributes"><code>
		public  
		boolean
	</code></td>

	<td class="name">

$auto_heading

TRUE
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="caption" id="$caption">
	<td class="attributes"><code>
		public  
		mixed
	</code></td>

	<td class="name">

$caption

NULL
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="template" id="$template">
	<td class="attributes"><code>
		public  
		mixed
	</code></td>

	<td class="name">

$template

NULL
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="newline" id="$newline">
	<td class="attributes"><code>
		public  
		string
	</code></td>

	<td class="name">

$newline

"\n"
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="empty_cells" id="$empty_cells">
	<td class="attributes"><code>
		public  
		string
	</code></td>

	<td class="name">

$empty_cells

""
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="function" id="$function">
	<td class="attributes"><code>
		public  
		boolean
	</code></td>

	<td class="name">

$function

FALSE
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
</table>
⚠️ **GitHub.com Fallback** ⚠️