I have a service called useTR.php
. It has a public method exampleService()
.
In the variables folder I have added the following code in my KGVariable.php
(KG is my plugin name)
public function sayHello() {
return craft()->useTR->exampleService();
}
In my templates folder I have an html that gets loaded after a form submission and that html has the following code.
<p>Thank you {{ craft.KG.sayHello() }} will contact you soon</p>
When this HTML is loaded, I get the following error:
Twig Runtime Error – Twig_Error_Runtime Calling unknown method: craft\web\twig\variables\CraftVariable::keyword()
What am I doing wrong? Kindly help (I am a beginner at Craft). Thanks.
craft()
function in v3