Welcome Guest, Not a member yet? Register   Sign In
Table Helper Enhancement: Exclude Columns
#1

[eluser]UncleBerty[/eluser]
I've added a method to allow specific columns to be excluded from the table, when using the automatic table creation class.

Anybody know how I can submit this back to the repository for inclusion in the next release?

Rob.
#2

[eluser]Derek Allard[/eluser]
Would you like to offer the community a chance for feedback? If so, include code.

Does it run on PHP 4 and 5? Is it tested? Did you follow the CI code standards (see userguide).

Thanks, and welcome to CI!
#3

[eluser]UncleBerty[/eluser]
Can't attach file (as PHP or TXT) - something about invalid MIME type.

Bulk of code, although not all, is :-

Code:
// --------------------------------------------------------------------

    /**
     * Sets a list of comma-separated columns (by name) to exclude from the table, including headings
     * If 'set_heading' has been used, the heading and column name must match for this to work
     *
     * @access    public
     * @return    void
     */
    function exclude_columns($column_list)
    {
        // explode out into an array so we can remove and white space
        $aryColumns = explode(",",$column_list);
        $aryNewColumns = array();
        
        foreach ($aryColumns as $column) {
            // trim the white space
            $column = trim($column);

            if ($column != '') {
                // add back to the new array if it's not blank
                $aryNewColumns[] = $column;
            }
        }

        // implode back into an array
        $this->columns_to_exclude = implode(",",$aryNewColumns);
    }
    
    // --------------------------------------------------------------------


Should run under any version of PHP.

It is fully tested, using both automatic headers and user defined ones. There is a documented caveat to the headers, where the heading name doesn't match the column name, but this can easily be sorted by including both name variations in the exclude list.

I'll check the coding standards, but I copied the same format as was already there.

Rob.
#4

[eluser]UncleBerty[/eluser]
I've read the Goals page - http://ellislab.com/codeigniter/user-gui...goals.html - but can't see anything else about specific coding standards. Perhaps you can point me at the page?

Rob.
#5

[eluser]Derek Allard[/eluser]
Quote:Can’t attach file (as PHP or TXT) - something about invalid MIME type.
Most people just post a zip file - that's probably easiest here for you.

Quote:Should run under any version of PHP.
Has it been tested, and on what specific versions?

Quote:I can’t see anything else about specific coding standards. Perhaps you can point me at the page?
You bet : http://ellislab.com/codeigniter/user-gui...guide.html

And also it sounds like you documented your code with a userguide? I so, be sure to include those also. I hope the community has a chance to vet and use your code.
#6

[eluser]UncleBerty[/eluser]
OK, checked through the standards and changed everything I could see. Interestingly, some of the code in the Table class breaks the '===' standards :p

I've also attached a ZIP file with the code in.

Code was tested on PHP for VMS v4.3.10, but doesn't use any _unusual_ functions, so should be backwards/forwards compatible.

Could you give me an idea of the basic process in place to take a change and incorporate it? If it's going to be horrendous then I might just code my own libraries rather than try and improve and submit existing ones.

Thanks, Rob.




Theme © iAndrew 2016 - Forum software by © MyBB