Php Joomla 3模块h3标题范围
我可以更改模块标题中第一个单词的颜色。 可以通过在标题的第一个单词上添加一个span来完成 下面的modules.php代码适用于此OK 但是 在Joomla admin中,当我为模块类后缀创建一个类时,它不是为前端的模块创建的 module.php中缺少启用在Joomla admin中创建的模块类后缀的内容 这是我为templates/mytemplate/html/modules.php编写的代码Php Joomla 3模块h3标题范围,php,joomla,module,Php,Joomla,Module,我可以更改模块标题中第一个单词的颜色。 可以通过在标题的第一个单词上添加一个span来完成 下面的modules.php代码适用于此OK 但是 在Joomla admin中,当我为模块类后缀创建一个类时,它不是为前端的模块创建的 module.php中缺少启用在Joomla admin中创建的模块类后缀的内容 这是我为templates/mytemplate/html/modules.php编写的代码 <?php /** * @package Joomla.Adminis
<?php
/**
* @package Joomla.Administrator
* @subpackage Templates.protostar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* This is a file to add template specific chrome to module rendering. To use it you would
* set the style attribute for the given module(s) include in your template to use the style
* for each given modChrome function.
*
* eg. To render a module mod_test in the submenu style, you would use the following include:
* <jdoc:include type="module" name="test" style="submenu" />
*
* This gives template designers ultimate control over how modules are rendered.
*
* NOTICE: All chrome wrapping methods should be named: modChrome_{STYLE} and take the same
* two arguments.
*/
/*
* Module chrome for rendering the module in a submenu
*/
function modChrome_xhtmlwithcolor($module, &$params, &$attribs)
{
$headerLevel = isset($attribs['headerLevel']) ? (int) $attribs['headerLevel'] : 3;
if (!empty ($module->content)) : ?>
<?php if ($module->showtitle) : ?>
<h<?php echo $headerLevel; ?>><?php
$title = $module->title;
$title = split(' ', $title);
$title[0] = '<span>'.$title[0].'</span>';
$title= join(' ', $title);
echo $title;
?></h><?php echo $headerLevel; ?>>
<?php endif; ?>
<?php echo $module->content; ?>
<?php endif;
}
?>
>
在index.php模板模块中,我有
<jdoc:include type="modules" name="bottom-1" style="xhtmlwithcolor" />
有人可以帮助或建议解决此问题。模块类sfx作为
和$params
变量的一部分传递给您的modChrome\u xhtmlwithcolor()
。要在PHP中使用它,可以使用以下内容:
htmlspecialchars($params->get('moduleclass\u sfx'))
通常,您会倾向于将模块封装在
中,以便很好地打包,以便应用CSS、使用DOM操作等
所以你可能有:
echo“get('moduleclass\u sfx'))。“\”>”;
... 你的代码。。。
回声“;
Hey CPP从一个澳大利亚人到另一个澳大利亚人谢谢你的工作,它帮助了你,当你有机会的时候,别忘了标记正确的答案:D