Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1460

General Questions/New to Joomla! 4.x • accessing Joomla 4 From PHP

$
0
0
Hi

Our host is Siteground
We have used this code in Joomla 3 as a header.php file we include at the top of other PHP files

<?php

/* header file to access joomla */

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

/* If you need to use database object, add following line too */
$db=JFactory::getDBO(); // use this $db object for database related operation

?>

But now we try to upgrade to Joomla 4 this no longer works
Are things different in J4

Any help would really be appreciated

Cheers
Rich

Statistics: Posted by perryworld — Mon May 27, 2024 8:32 pm



Viewing all articles
Browse latest Browse all 1460

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>