简体   繁体   English

Joomla 2.5在我的模块中渲染内容插件

[英]Joomla 2.5 render content plugins in my module

I want to render Joomla content plugins in my module, how to do that ? 我想在我的模块中渲染Joomla内容插件,该怎么做?

Here is my code 这是我的代码

<pre>

<?php
defined( '_JEXEC' ) or die;

$db = JFactory::getDBO();   
$query = $db->getQuery(true);  
$query->select('stendas_id, stendas_lat, stendas_lon, stendas_name, stendas_description, stendas_kaire, stendas_desine')
        ->from('#__stendukai_stendai')
        ->where('published = 1');  
$db->setQuery($query);

$rows = $db->loadObjectList();

require JModuleHelper::getLayoutPath('mod_stendulist', $params->get('layout', 'default'));

</pre>

Here is default.php file code 这是default.php文件代码

<pre>
<?php
defined( '_JEXEC' ) or die;

$document = JFactory::getDocument();

$document->addStyleSheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/ui-lightness/jquery-ui.css');     
$document->addScript("http://maps.google.com/maps/api/js?sensor=false&language=en");  
$document->addScript(JURI::base() . 'modules/mod_stendulist/libs/jquery.min.js');
$document->addScript(JURI::base() . 'modules/mod_stendulist/libs/jquery-noconflict.js');
$document->addScript('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js');  
$document->addScript(JURI::base() . 'modules/mod_stendulist/libs/jquery.ui.map.js');
$document->addScript(JURI::base() . 'modules/mod_stendulist/libs/frontend_map.js');
$document->addScript(JURI::base() . 'modules/mod_stendulist/libs/jquery.ui.map.services.js');
$document->addScript(JURI::base() . 'modules/mod_stendulist/libs/jquery.ui.map.extensions.js');

?>

<div id="themapstuff">
    <table class="stendu_table" border="0" cellpadding="0" cellspacing="0" height="151" width="406">
       <tbody>
         <tr><th width="33">Nr.</th><th width="115">Stendai</th><th width="74">Kairė</th><th width="74">Dešinė</th></tr>
    <?php $i=1; ?>


         <?php foreach ($rows as $row): ?>
         <tr data-gmapping='{"id":" <?php echo $row->stendas_id ?>","latlng":{"lat": <?php echo $row->stendas_lat ?>,"lng": <?php echo $row->stendas_lon ?>},"tags":" <?php echo $row->stendas_name ?>"}'>
            <td><?php echo $i++ ?></td>
            <td> <span class="title"><?php echo $row->stendas_name ?></span> 
               <div class="info-box">
                  <?php echo $row->stendas_description;?>
               </div>
            </td>
            <td><?php echo $row->stendas_kaire ?></td>
            <td><?php echo $row->stendas_desine ?></td>

         </tr>
         <?php endforeach ?>
       </tbody>
    </table>      
</div> 
</pre>

If it is possible I mostly interesting to run content plugin in 如果有可能我最感兴趣的是运行内容插件

$row->stendas_description

because this is actual content others are the id and alias. 因为这是实际内容,其他人是id和别名。

The custom html module renders plugins if you set the Prepare Content parameter to true. 如果将Prepare Content参数设置为true,则自定义html模块将呈现插件。

JPluginHelper::importPlugin('content');

$module->content = JHtml::_('content.prepare', $module->content, '', 'mod_custom.content');

https://github.com/joomla/joomla-cms/blob/master/modules/mod_custom/mod_custom.php#L14 https://github.com/joomla/joomla-cms/blob/master/modules/mod_custom/mod_custom.php#L14

I have never tested this extension, but it might be what you're looking for. 我从来没有测试过这个扩展,但它可能是你正在寻找的。

http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/embed-a-include/6713 http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/embed-a-include/6713

Even though it only shows the Joomla 1.5 icons, it is also compatible with Joomla 1.7, thus also with 2.5. 即使它只显示Joomla 1.5图标,它也与Joomla 1.7兼容,因此也与2.5兼容。 This extension allows allows the execution of a plugin in a module. 此扩展允许允许在模块中执行插件。

Hope this helps. 希望这可以帮助。

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

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