-
-
Save CB9TOIIIA/45179fb17da8e378c24abd37cbef0071 to your computer and use it in GitHub Desktop.
Вывод модулей в шаблоне Joomla
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //вывод позиции модулей | |
$document = JFactory::getDocument(); | |
$renderer = $document->loadRenderer('modules'); | |
$options = array('style' => 'xhtml'); | |
$position = 'user1'; | |
echo $renderer->render($position, $options, null); | |
?> | |
<!-- или --> | |
<?php | |
$modules =JModuleHelper::getModules('position-0'); | |
foreach ($modules as $module){ | |
echo JModuleHelper::renderModule($module); | |
} | |
?> | |
<!-- Вывод одного модуля --> | |
<?php //Вывод одного модуля | |
$document = JFactory::getDocument(); | |
$renderer = $document->loadRenderer('module'); | |
$options = array('style' => 'raw'); | |
$module = JModuleHelper::getModule('mod_custom_banners'); | |
$module->params = "heading=2\nlimit=10"; //как видим даже параметры задавать | |
echo $renderer->render($module, $options); | |
?> | |
<!-- или --> | |
<?php | |
$module = JModuleHelper::getModule('mod_banners'); | |
echo JModuleHelper::renderModule($module); | |
?> | |
<!-- Вывод модуля по id --> | |
<?php //выводим модуль по id | |
$document = JFactory::getDocument(); | |
$renderer = $document->loadRenderer('module'); | |
$params = array('style'=>'xhtml'); | |
$dbo = JFactory::getDBO(); | |
//получить модуль как объект | |
$dbo->setQuery("SELECT * FROM #__modules WHERE id='111' "); | |
$module = $dbo->loadObject(); | |
//убрать предупреждение | |
$module->user = ''; | |
echo $renderer->render($module, $params); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment