Hey guys. I’m trying to use a template for sending an email. I realize there is no documentation for this so I’m following what they do in the admin plugin.
My plugin estructura is this:
— md
getform
templates
base.html.twig
getform.php
getform.yaml
And in geform.php I have the following:
--- php
$body = $this->grav['twig']->processTemplate('base.html.twig', ['header'=>$header,'content' => $content]);
$message = $this->grav['Email']->message($subject, $body, 'text/html')
->setFrom($from)
->setTo($to);
$sent = $this->grav['Email']->send($message);
Now. This is giving me a resource not defined error. Then found out something else they do in Admin, they find and then load the resources. With something like this:
—php
$template_paths = $this->grav[‘locator’]->findResources(’/templates’);
$loader_chain = $this->grav[‘twig’]->twig->getLoader()->addLoader(new \Twig_Loader_Filesystem($template_paths));
But that still is NOT working for me. It gives me an **invalid resource** error.
Don't know what to do. Any ideas?
Thanks.