【发布时间】:2013-09-26 22:21:36
【问题描述】:
我不能使用辅助函数
我在 site->helpers->document_management.php 中有一个帮助文件
我在那个文件中有一个类 定义('_JEXEC')或死;
/**
* Document_managment helper.
*/
class Document_managmentHelper
{
function testFunction()
{
$textis= "hello";
return $textis;
}
}
在我的站点->views->document->view.html.php
我尝试调用函数testFunction:
$callingCard = Jview::loadHelper('Document_managment');
//require_once JPATH_COMPONENT.'/helpers/document_managment.php';
$getprofileinfo = Document_managmentHelper::testFunction();
echo getprofileinfo;
echo "test is ". JPATH_COMPONENT.'/helpers/document_managment.php';
我才明白
PHP 致命错误:在第 xx 行的 /var/www/vhosts/mydomain.com/httpdocs/components/com_document_managment/views/document/view.html.php 中找不到类“Document_managmentHelper”
我想不通
【问题讨论】:
-
JView?此外,您的函数未声明为静态,您不应将其称为静态。你也没有说你在哪个版本,但在 J+ 中它会是 JViewLegacy。
-
@Elin:助手类的和方法应该是静态的;一些 Joomla 版本允许一些松弛,但最好简单地将两者声明为静态。 user1616338,它与require_once一起工作吗?该类未加载...
-
我真的认为小写 V 是问题所在。
标签: joomla components