Using AppUI function in function

I am translating a site and I need to enter the $AppUI->_('')

system administrator for translation. But somehow I cannot use it in this function.

What am I doing wrong?

Here is my script and I hope you can help me:

public function BeginCalc()
{
    if($this->getActive())
    {
        echo $AppUI->_('Calculating');
    }
    else
    {
        $this->_BeginCalculation();
        echo "Calculation has been started";
    }
}

      

And, when I use this, I get the error Fatal error: Call to a member function _() on a non-object in

. Tried searching on Stackowerflow but the answers there didn't help me solve the problem.

+3


source to share


1 answer


$ AppUI does not exist in this area. If it is a global variable, you need to import it with the global keyword.



But I would rather advise you to make the $ AppUI object single and reference it using AppUI :: getInstance () → _ ('Calculation');

+2


source







All Articles