summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Table.php16
-rw-r--r--user_guide_src/source/changelog.rst1
-rw-r--r--user_guide_src/source/libraries/table.rst2
3 files changed, 18 insertions, 1 deletions
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index fb154e50f..947aedd8f 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -49,9 +49,23 @@ class CI_Table {
public $empty_cells = '';
public $function = FALSE;
- public function __construct()
+ // --------------------------------------------------------------------------
+
+ /**
+ * Set the template from the table config file if it exists
+ *
+ * @param array $config (default: array())
+ * @return void
+ */
+ public function __construct($config = array())
{
log_message('debug', "Table Class Initialized");
+
+ // initialize config
+ foreach ($config as $key => $val)
+ {
+ $this->template[$key] = $val;
+ }
}
// --------------------------------------------------------------------
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index b5fb52df4..069dc071d 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -85,6 +85,7 @@ Release Date: Not Released
- Minor speed optimizations and method & property visibility declarations in the Calendar Library.
- Removed SHA1 function in the :doc:`Encryption Library <libraries/encryption>`.
- Added $config['csrf_regeneration'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which makes token regeneration optional.
+ - Allowed for setting table class defaults in a config file.
- Added function error_array() to return all error messages as an array in the Form_validation class.
- Added function set_data() to Form_validation library, which can be used in place of the default $_POST array.
- Added function reset_validation() to form validation library, which resets internal validation variables in case of multiple validation routines.
diff --git a/user_guide_src/source/libraries/table.rst b/user_guide_src/source/libraries/table.rst
index 9bc3f3423..6a808abc2 100644
--- a/user_guide_src/source/libraries/table.rst
+++ b/user_guide_src/source/libraries/table.rst
@@ -116,6 +116,8 @@ example, only the table opening tag is being changed::
$tmpl = array ( 'table_open' => '<table border="1" cellpadding="2" cellspacing="1" class="mytable">' );
$this->table->set_template($tmpl);
+
+You can also set defaults for these in a config file.
******************
Function Reference