gpt4 book ai didi

php - Joomla 2.5 在我的模块中呈现内容插件

转载 作者:搜寻专家 更新时间:2023-10-31 21:13:53 25 4
gpt4 key购买 nike

我想在我的模块中呈现 Joomla 内容插件,该怎么做?

这是我的代码

<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>

这里是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>

如果可能,我最感兴趣的是在

中运行内容插件

$row->stendas_description

因为这是实际内容,所以其他人是 ID 和别名。

最佳答案

如果您将 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

关于php - Joomla 2.5 在我的模块中呈现内容插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13309800/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com