简体   繁体   English

在外部HTML页面中获取Joomla3用户数据

[英]Get Joomla3 user data in external html page

I have a joomla3 website,i built an external html page which is a client side app(jquery),visibile only to logged in users. 我有一个joomla3网站,我建立了一个外部html页面,它是一个客户端应用程序(jquery),仅对登录用户可见。 The page is in a directory in the webserver's root. 该页面位于Web服务器根目录中的目录中。

I would have on the top of this html page the data of the current user. 我将在此html页面的顶部拥有当前用户的数据。 Is that possible? 那可能吗?

I didn't find nothing that work in my situation. 在我的情况下,我没有发现任何有效的方法。 Seems JFactory doesn't exist in joomla3. 看来jFactory在joomla3中不存在。

Thanks 谢谢

Exists as far as I know https://github.com/joomla/joomla-cms/blob/master/libraries/joomla/factory.php 据我所知存在https://github.com/joomla/joomla-cms/blob/master/libraries/joomla/factory.php

Take a look at error php and that may help you get an idea of how to so a stand alone page. 看一下错误php,它可以帮助您了解如何制作一个独立的页面。 Note however ha you need to give the platform from a standalone application you need to make sure you are pointing at the right folder. 但是请注意,如果您需要从独立应用程序提供平台,则需要确保指向正确的文件夹。

You need to initialize the whole framework in order to get access to its parts. 您需要初始化整个框架才能访问其各个部分。 Take the main index.php as an example for how to do that. 以main index.php为例,说明如何执行此操作。 Instead of routing and dispatching, put your code in there. 不用路由和分派,而是将代码放在那里。

standalone-script.php standalone-script.php

<?php
/**
 * Constant that is checked in included files to prevent direct access.
 */
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';

// Instantiate the application.
$app = JFactory::getApplication('site');

// Initialise the application.
$app->initialise();

// Your code goes here...

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

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