在外部页面显示Joomla菜单


Showing Joomla menu on external page

你好,我试图在我的外部页面上显示joomla菜单,这是我在外部php文件上的代码,是否有其他方法可以做到同样的事情,提前感谢帮助。

define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__).'/../' );   // should point to joomla root
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();

jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModules('xxxx');
echo JModuleHelper::renderModule($module[0]);

如何这样做的示例显示在offline.php和error.php模板中。

$app             = JFactory::getApplication();
$doc             = JFactory::getDocument();
//all the code to start your html
        <div class="navigation">
            <?php // Display position-1 modules ?>
            <?php echo $doc->getBuffer('modules', 'position-1', array('style' => 'none')); ?>
        </div>
// all the code to end your html

来自protostar