Search code examples
modx-revolution

Why am I seeing this? "Fatal error: Call to a member function [functionName()] "


I have a function and I create a snippet in modx revolution:

function functionName(){
    //code here
}

I got this fatal error:

Fatal error: Call to undefined function functionName()

Can anyone tell me how to create functions in snippets in modx revolution?


Solution

  • After lot of effort i get one solution that in Modex now using totaly oops , so directly use function call in page not work , so create Class and put function and then create object and call and it work..:)

         Class ClassName{
             function functionName() {  //code here  }
        }
        var myobj = new ClassName();
        myobj->functionName() //it work