Wicky Posted May 12, 2007 Share Posted May 12, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/51040-eval-function-string-error/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.