Joomla 3模块替代布局显示在下拉列表中,但不适用于模块

时间:2013-10-16 23:26:51

标签: joomla joomla3.1 joomla-module

我下载并安装了一个名为rQuotes的模块,我尝试使用其他布局进行调整。首先,我将default.php复制到模板目录中html下的相应文件夹mod_rquotes,将其名称更改为testimonials.php并进行了更改。替代布局在管理员中正确显示,但在选中时,不使用替代布局,而是继续使用default.php布局。

关于文章模板的一些注释,我尝试复制mod_rquotes.xml并将其命名为testimonials.xml,但这没有效果。我将模块放置在任何组件的模块中直接放入文章中,所以我不认为菜单限制会产生任何影响。

按要求提交mod_rquotes.php:

<?php

 /**
 * Rquotes main file
 * 
 * @package    Joomla.Rquotes
 * @subpackage Modules
 * @link www.mytidbits.us
 * @license     GNU/GPL-2
 */

 //no direct access
defined('_JEXEC') or die('Restricted access'); 
if(!defined('DS')){
define('DS',DIRECTORY_SEPARATOR);
error_reporting(0);
}

    //include helper file   
    require_once(dirname(__FILE__).DS.'helper.php'); 

$source=$params->get('source');
//text file params
$filename=$params->get('filename','rquotes.txt');
$randomtext=$params->get('randomtext');
//database params
$style = $params->get('style', 'default'); 
$category=$params->get('category','');
$rotate = $params->get('rotate');
$num_of_random= $params->get('num_of_random');


switch ($source) 
{
case 'db':
if($rotate=='single_random')
{

 $list = modRquotesHelper::getRandomRquote($category,$num_of_random);

}


elseif($rotate=='multiple_random')
{

 $list = modRquotesHelper::getMultyRandomRquote($category,$num_of_random);

}
elseif($rotate=='sequential') 

{

    $list = modRquotesHelper::getSequentialRquote($category);

}
elseif($rotate=='daily')
{

$list= getDailyRquote($category);


}

elseif($rotate=='weekly')
{

    $list= getWeeklyRquote($category);

}
elseif($rotate=='monthly')
{

    $list= getMonthlyRquote($category);

}
elseif($rotate=='yearly')
{

    $list= getYearlyRquote($category);

}
//start
elseif($rotate=='today')
{

    $list= getTodayRquote($category);

}

//end
require(JModuleHelper::getLayoutPath('mod_rquotes', $style,'default'));
break;

case 'text':
if (!$randomtext)
{
$list=getTextFile($params,$filename);
}
else
{
$list=getTextFile2($params,$filename);
}
break;
default:
echo('Please choose a text file and Daily or Every page load and save it to display information.');


}
?> 

1 个答案:

答案 0 :(得分:0)

这个模块是错误的,就是这样。 查看代码,如果您使用文本文件作为源,它会将布局硬编码到其助手中的textfile布局。 如果您使用数据库作为源,它不会变得更好。看起来它确实获得了模块chrome(样式)设置并将其应用于布局,布局也将失败。

我个人不会使用这个模块,因为它写得太可怕了。但是,如果您需要它,您可以在模板中使用自己的文本文件布局覆盖文本文件布局。将文件命名为textfile.php并进行更改,它将起作用。

相关问题