Jump to content

eval function string error!


Wicky

Recommended Posts

Hi, i am looking for help regarding the eval function in php.

 

The story is, i have a function below in an object call datagrid :

function showSelectorColumn($columnName, $controlName, $valueSeed)
    {
    
        // adds column to the array of columns specified by the user
        $this->showCustomColumn("%dataGrid_selectorColumn%", $columnName);
        
        // unsets any action for this column and blocks any further settings of actions for this column
        $this->unsetActionFunction("%dataGrid_selectorColumn%", true);
        
        // disables sorting for this column
        $this->disableSorting("%dataGrid_selectorColumn%");
        
        // the function that will generate the content for the cell
        $functionString = "
            function _selector(\$data, \$rowData)
            {
                return '
                    <input type=\"checkbox\" style=\"margin:-2px;font-size:0px;\" name=\"".$controlName."[]\" value=\"'.@\$rowData[\"".$valueSeed."\"].'\" class=\"grid-row-selector-checkbox\" onclick=\"if (this.checked == false) {this.parentNode.parentNode.className = this.parentNode.parentNode.id} else {this.parentNode.parentNode.className = \'grid-row-selected\'}\">
                ';
            }
        ";
        
        // registers the function
        eval ($functionString);

}

Now i want to use the _selector function elsewhere in the object.

But as soon as i do "$this->_selector('param1',param2);

i get an error message saying the object is undefined. Can anybody help me with this?

 

Thankz alot

Link to comment
https://forums.phpfreaks.com/topic/51040-eval-function-string-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.