简体   繁体   English

自定义页面上的Joomla模块

[英]Joomla module on custom page

I created a component in my Joomla website theme folder, like so: 我在Joomla网站主题文件夹中创建了一个组件,如下所示:

/templates/rt_afterburner/html/com_content/article

By custom page, I mean an Alternate Layout for an article. 所谓自定义页面,是指文章的替代布局。 I copied the Default.php file and edited it. 我复制了Default.php文件并进行了编辑。

Then I created a php file and that is all working correctly. 然后,我创建了一个php文件,并且所有文件均正常工作。

I am trying to get this "latest news" module from the homepage on my page but I am not sure what I have to call to render this. 我正在尝试从页面首页上获取“最新消息”模块,但是我不确定要调用此模块必须调用什么内容。

<div id="latestnews" class="highlightblock single"><jdoc:include type="modules" name="fp_latestnews" style="xhtml" /></div>

I have tried coping over the module files to where my php file is and included: 我已经尝试将模块文件处理到我的PHP文件所在的位置并包括在内:

$app = JFactory::getApplication(); 

But I can't seem to get this to work. 但是我似乎无法使它正常工作。

You could load a module in a layout override file using JModuleHelper/renderModule method. 您可以使用JModuleHelper / renderModule方法在布局覆盖文件中加载模块。

jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule( 'mainmenu', 'Key Concepts' );
$attribs['style'] = 'xhtml';
echo JModuleHelper::renderModule( $module, $attribs );

Reference: JModuleHelper/renderModule 参考: JModuleHelper / renderModule

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM