简体   繁体   English

在自定义页面上呈现joomla模块内容

[英]render joomla module content on custom page

So I want to render a custom_html module which has just an image and some text on it, in a pop-up window. 因此,我想在弹出窗口中呈现一个custom_html模块,该模块上只有一个图像和一些文本。 I am using custom_html as a "cheap" backoffice. 我正在使用custom_html作为“便宜”的后台。 I just want to extract the info from the module content. 我只想从模块内容中提取信息。

So I know the module id (180), how can I render that particular module on a custom page that's independent of the rest? 因此,我知道模块ID(180),如何在自定义页面上呈现与其余模块无关的特定模块? What type of includes I need to state at the beginning of the php file? 我需要在php文件的开头声明哪种类型的包含项? I know I have to setup some constants and imports, but not sure what's the "right" way or "joomla way" of doing this, I thought that this would be a simple task, where is what I have so far: 我知道我必须设置一些常量和导入,但是不确定执行此操作的“正确”方式还是“ joomla方式”,我认为这将是一个简单的任务,到目前为止,我在哪里?

include(JPATH_BASE.'libraries/loader.php');
jimport( 'joomla.application.module.helper' );

Thank you all 谢谢你们

I would probably write a custom tmpl-file to handle this: 我可能会编写一个自定义的tmpl文件来处理此问题:

  • Create a file module.php in /templates/yourtemplate/ 在/ templates / yourtemplate /中创建文件module.php
  • module.php can contain the following: module.php可以包含以下内容:
 <html><head><title>My module</title></head> <body> <jdoc:include type="modules" name="mymodule" style="xhtml"> </body> </html> 

possibly including other stuff that you need. 可能包括您需要的其他东西。 Set up the module to display on all pages, using position mymodule. 使用位置mymodule设置模块以在所有页面上显示。

Now you can call the modal window from anywhere using the following code: 现在,您可以使用以下代码从任何地方调用模式窗口:

<?php JHTML::_('behavior_modal'); ?>
<a href="<?php echo JRoute::_('index.php?Itemid='.$youritemid.'&tmpl=module'); ?>" 
class="modal" rel="{size: {x: 700, y: 500}, handler:'iframe'}">

This will display the module using the module.php file. 这将使用module.php文件显示模块。

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

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