Noob to Processwire. Trying to convert some older sites to Pwire. I am having trouble including a legacy form class into my templates:
If I embed the php directly in the template, it works. But if I use include statements, the form object returns null.
This works:
use formbuild\Form;
session_start();
$form = new Form(init1, 'init2', ...');
$form->param1 = ...;
$form->param2 = ...;
$form->param3 = ...;
$form->render();
-----------------------------------------------------------------------------------------
This fails:
include_once ($config->paths->templates."forms/form1.php");
$form->render();
____________________________________________________________________
My referencing is OK, no error message. The only code that cannot reside in the include file are the following lines:
use formbuild\Form;
$form = new Form(init1, 'init2', ...');
My PhP is rusty, maybe that is the problem, but it could be something about Pwire, namespace maybe. I have tested it outside Pwire and no problems.
Please advise. Thanks.