在外部php页面中加载joomla模块

时间:2015-06-06 04:45:03

标签: php joomla module external

我使用Joomla 3。

我想将一个joomla模块添加到一个单独的(来自joomla)PHP页面。这有可能吗?

从我在网上找到的,我需要调用joomla框架,然后???????然后就可以了。

<?php define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__));
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(); 


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>


</head>

<body>


                    <jdoc:include type="modules" name="position-22" style="none" />



</body>
</html>

1 个答案:

答案 0 :(得分:0)

是的,它可能

  • 初始化Joomla Framework(来自Joomla 3.4.1 index.php)

    const double N = 4;
    const double C = 1.0 / N; <---- 0.2500
    
    double *array = (double*)calloc(10, sizeof(double));
    
    memset(array, C, 10);
    
  • 初始化后,您可以使用define('_JEXEC', 1); if (file_exists(__DIR__ . '/defines.php')) { include_once __DIR__ . '/defines.php'; } if (!defined('_JDEFINES')) { define('JPATH_BASE', __DIR__); require_once JPATH_BASE . '/includes/defines.php'; } require_once JPATH_BASE . '/includes/framework.php'; $app = JFactory::getApplication('site'); $app->initialise();

    调用模块位置
    JHtml