I can't seem to figure out why it won't pick up the function. As you can figure by the include_once I have, the .php file is in another directory but I reference it correctly. I don't know php well at all but I've tried
this::theFuctionIWant();
phpIWantToInclude::theFunctionIWant();
this->theFunctionIWant();
phpIWantToInclude->theFunctionIWant();
Here is a watered-down version of the code. If you want more of the real code please let me know.
<?php
namespace Scripto\Api\Representation;
use DateTime;
use Omeka\Api\Representation\AbstractEntityRepresentation;
class phpIWantToInclude extends AbstractEntityRepresentation
{
stuff
.
.
.
public function theFunctionIWant()
{
stuff
.
.
.
return other stuff;
}
}
?>
<?php
namespace Scripto\Form;
include_once ($_SERVER['DOCUMENT_ROOT']."filePath/phpIWantToInclude.php");
use Laminas\Form\Form;
class BeepBoop extends Form
{
public function init()
{
stuff
.
.
.
$var = theFunctionIWant();
}
?>
CodePudding user response:
In my view you must check your namespace, the namespace must match in the diferent files regardless the include_once or require_once.