问题是自制模块无法正常工作-我在 Joomla 3.0 中制作了自制模块。我在这里创建了一个mod_products文件夹,我们创建了一个名为mod_products.php的文件。
mod_products.php - 代码
defined('_JEXEC') or die;
require_once __DIR__ . '/helper.php';
$value = modProductsHelper::getproducts( $params );
require JModuleHelper::getLayoutPath('mod_products', $params->get('layout', 'default'));
之后我制作了第二个文件helper.php代码 -
class modProductsHelper{
public static function getProducts( $params ){
return 'Products';
}
}
第三个是default.php
<?php
defined('_JEXEC') or die;
if($value!='') { ?>
<ul style="margin-left: 0px;" class="clients-list slides-list slide-wrapper">
<li class="slide">
<div class="product-image"><img src="images/product3.png" width="181" height="177"></div>
</li>
</ul>
<?php } ?>
然后我们通过管理员面板安装并给mod_products模块一个位置并显示在index.php文件中,如下所示:
<div class="grid_12 product_home">
<jdoc:include type="modules" name="position-3" />
</div>
但它没有显示在网站上。有谁知道为什么?
编辑:mod_products.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.0" client="site" method="upgrade">
<name>mod_products</name>
<author>Joomla! Project</author>
<creationDate>July 2004</creationDate>
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>MOD_PRODUCTS_XML_DESCRIPTION</description>
<files>
<filename module="mod_products">mod_products.php</filename>
<folder>tmpl</folder>
<filename>helper.php</filename>
<filename>mod_products.xml</filename>
</files>
<config>
</config>
</extension>