私は管理パネルからいくつかのサブページに追加するモジュールを持っています。その後、いくつかのサブページはこのモジュールで適切なコンテンツを表示しますが、サブページをクリックすると、内容がない空白の白いページが開きます。私はその問題の原因を知りません。なぜこのモジュールを使ったいくつかのサブページが正しく動作し、いくつかは空白のページを表示するのですか? これは私がページに表示されるものです。Joomlaのサブページにモジュールを追加
致命的なエラー:行15
に/opt2/data-dev/modules/mod_products_menu/helper.phpでクラスModProductsMenuHelperを再宣言することはできません助けてくれてありがとう! これは、私はあなたがモジュールを作成し、特定のページにそれを割り当てられている集めることができるものから、私のコード
<?php
/**
* Slajder class for Hello World! module
*
* @package Joomla.Tutorials
* @subpackage Modules
* @link http://docs.joomla.org/J3.x:Creating_a_simple_module/Developing_a_Basic_Module
* @license GNU/GPL, see LICENSE.php
* mod_helloworld is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
class ModProductsMenuHelper
{
/**
* Retrieves the hello message
*
* @param array $params An object containing the module parameters
*
* @access public
*/
public function getProducts($params)
{
$lang = JFactory::getLanguage();
$langTag = $lang->getTag();
$app = JFactory::getApplication();
$isSMB = $app->get('isSMB');
$parentMenuId = $langTag == 'pl-PL' ? 107 : 103;
$results = $this->getChildren($parentMenuId, $langTag);
return $results;
}
private function getChildren($parentId, $langTag){
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query
->select(array('id', 'title', 'path', 'alias'))
->from($db->quoteName('#__menu'))
->where("(language = '*' OR language= ".$db->quote($langTag).") AND published = 1 AND parent_id=".$parentId)
->order($db->quoteName('lft') . ' ASC, '.$db->quoteName('id') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $db->loadObjectList();
foreach ($results as $key=>$val){
$results[$key]->children = $this->getChildren($val->id, $langTag);
}
return $results;
}
}
モジュールの内容はカスタムhtmlです。このモジュールはホームページ上にあり、製品のリストです。今、このモジュールを他のサブページに追加したいと思います。したがって、この製品のリストが他のページのメインページでも正しく動作するかどうか私はモジュールを追加する方法を知っていますが、このモジュールをオンにした後にいくつかのサブページで白いページが表示される理由はわかりません。 Joomlaの私のバージョンはJoomla! 3.4.3。 –
提案したようにエラー報告を有効にしましたか?これは間違いなく問題のトラブルシューティングに役立ちます。結果を元の質問に追加します。 – TheOrdinaryGeek
質問を編集しました。 –