我似乎已經嘗試了一切。我正在嘗試學習如何創建一個新組件,目前我的文件夾結構看起來像這樣(請注意組件會安裝)。調用未定義的方法JController :: getInstance()
這是我的文件夾結構的圖片:
伊夫關閉了一些的,因爲我發現它irelevant但請,如果你需要看到什麼他們裏面請讓我知道。
正如我上面所述,組件的安裝沒有問題。然而,當我試圖訪問它,我得到以下錯誤:
Fatal error: Call to undefined method JController::getInstance() in /home/marcrasm/public_html/Joomla/administrator/components/com_helloworld/helloworld.php on line 13
現在是闖民宅的文件是這個:
<?php
defined('_JEXEC') or die ('Restricted access');
jimport('joomla.application.component.controller');
$doc = JFactory::getDocument();
$doc->addScript("/components/com_helloworld/js/jquery.js");
$doc->addScript("/components/com_helloworld/js/com_helloworld_script.js");
$doc->addStyleSheet("/components/com_helloworld/css/com_helloworld_layout.css");
// gets the instance of the controller
// Get an instance of the controller prefixed by HelloWorld
$controller = JController::getInstance('HelloWorld');
// Perform the Request task
$input = JFactory::getApplication()->input;
$controller->execute($input->getCmd('task'));
// Redirect if set by the controller
$controller->redirect();
我知道這很難說,但沒有人知道這個問題可能是什麼?
哈哈我有兩個網站一個2.5和一個3.0。所以我在3.0上工作了一週,當我返回來修復2.5中的某些內容時......等等!崩潰! :P – themis