简体   繁体   中英

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. The page is in a directory in the webserver's root.

I would have on the top of this html page the data of the current user. Is that possible?

I didn't find nothing that work in my situation. Seems JFactory doesn't exist in joomla3.

Thanks

Exists as far as I know 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. 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. Instead of routing and dispatching, put your code in there.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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