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 8651b9e69..ceda6f323 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 1c9e1992d..1f148e9d4 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -89,6 +89,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.
- Form Validation library now allows setting of error delimiters in the config file via $config['error_prefix'] and $config['error_suffix'].
- 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.
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