diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-12 15:27:25 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-12 15:27:25 +0100 |
commit | 997c0da672a5483fd88fe96272004a13ad510cd4 (patch) | |
tree | 781578ae4af3ceee278ab9c0674110f3b8aff3ff | |
parent | 95bd1d1a5f5bdccfde53cc27d7d5c20991112643 (diff) | |
parent | 21e7a3b315335a622b73710f0effa09dc0f85bb6 (diff) |
Merge pull request #1078 from mikedfunk/feature/table_config
Ability to use a configuration file for the Table class
-rw-r--r-- | system/libraries/Table.php | 16 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 | ||||
-rw-r--r-- | user_guide_src/source/libraries/table.rst | 2 |
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 |