问题是自制模块不起作用--我在Joomla3.0中制作了自己的模块。我在这里创建了一个名为mod_products.php.的mod_products文件夹
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>但它并没有在网站上显示。有人知道为什么吗?
Edit: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>发布于 2013-11-22 10:21:12
好吧,我给你做了个小例子。我认为这可能是因为你调用了错误的模块布局,不完全确定。
下面是下载模块的链接。通过Joomla后端卸载正在使用的当前模块,并安装如下:
products.zip
另外,不要忘记将模块分配给菜单项。这可能是以前的问题
尽情享受
发布于 2013-11-22 10:06:38
对我来说,您的问题似乎是模块name.In,有些地方您使用了mod_product,而在其他地方,mod_products请确保您只使用一个。
require JModuleHelper::getLayoutPath('mod_products', $params->get('layout', 'default'));至
require JModuleHelper::getLayoutPath('mod_product', $params->get('layout', 'default'));还检查您是否发布了模块,并对所有页面进行了测试。
https://stackoverflow.com/questions/20141708
复制相似问题