How to get component instance via code Joomla 1.7 - php

I want to use my Joomla 1.7 Components from a webservices placed inside the same server.
In other words, I have another file that will be used by mobile-apps to do stuff.
I'd like to use joomla core functions nor having to duplicate code nor having to make direct inserts in the DB bypassing joomla and formatting them to match "what Joomla would do".
For now I am able to get the DBO objects and make queries using joomla, but I want to use every component I need.
For example,
<?php
if (!defined('_JEXEC')) { define('_JEXEC', 1); }
if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); }
if (file_exists(dirname(dirname(__FILE__)) . '/defines.php'))
{
include_once dirname(dirname(__FILE__)) . '/defines.php';
}
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', dirname(dirname(__FILE__)));
require_once JPATH_BASE.'/includes/defines.php';
}
require_once JPATH_BASE.'/includes/framework.php';
// Mark afterLoad in the profiler.
JDEBUG ? $_PROFILER->mark('afterLoad') : null;
$db = JFactory::getDocument()->getDBO();
$query = $db->getQuery(true);
$query->select('r.id');
$query->from('#__asd as r');
$query->join('LEFT', '#__xxx cc on cc.recipe_id = r.id');
// Prepare where clause
$query->where('r.published = 1');
$query->group('r.id');
$db->setQuery($query);
$objectsList = $db->loadObjectList();
$res = formatResult($objectsList);
function formatResult($obj)
{
if($obj === NULL || !is_array($obj)){ return array('data' => 'Vuoto', 'code' => 0); }
return array('data' => (array)$obj, 'code' => 1);
}
?>
EDIT: More specifically, I have installed (JFBconnect) and I want its functionality to login and register users from app.

Related

Joomla Call to a member function get() on null

I have very little php knowledge. I know I'm doing something wrong, but what?
I'm adding the sass compiler from Joomla Master Bootstrap template into my own Joomla template. It works, but not as it should. I can't turn it on or off in the backend.
The code in Masterbootstrap is this:
include 'includes/params.php';
if ($params->get('compile_sass', '0') === '1') {
require_once "includes/sass.php";
}
In my template I don't have params.php, but /functions/tpl-init.php. I added the variable $compile_sass there. My code looks like this:
require_once __DIR__ . '/functions/tpl-init.php';
if ($params->get('compile_sass', '0') === '1') {
require_once "includes/html/sass.php";
}
Doesn't work. I get the error: Call to a member function get() on null
So I changed this into:
require_once __DIR__ . '/functions/tpl-init.php';
require_once "includes/html/sass.php";
That works, but now the compiler is permanently on.
What should I do to correct this?
To get template params from outside the template you need to do this
Template parameters from outside a template
$app = JFactory::getApplication('site');
$temp = $app->getTemplate(true);
$param = $temp->params->get('compile_sass', '0');
Remember the Masterbootstrap template should be active.
To get any template param you need to do this
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query ->select('params')
->from('#__template_styles')
->where('`template` = ' . $db->q('masterbootstrap')) // Check Spelling of template
->where('client_id = 0'); // client_id = 0 for Site and client_id = 1 for Admin
$db->setQuery($query);
$params = json_decode($db->loadResult());
echo $params->compile_sass;
Better is to create a similar param in your own template using your templateDetails.xml file rather than depending on the external template.
I got help from a friend. He solved it in a minute. It's so simple... it usually is, after you found the solution:
require_once __DIR__ . '/functions/tpl-init.php';
if ($compile_sass === '1')
{
require_once "includes/html/sass.php";
}

Programmatically add a Joomla Article from CLI

I want to be able to add many articles programmatically in Joomla, from the command line using the cli feature in Joomla CMS.
I am basically using Create a Joomla! Article Programmatically but my script closes out after creating just one article with the error line
Error displaying the error page: Application Instantiation
Error:Application Instantiation Error
This is the code that I am running from within the /cli folder in Joomla.
I am using Joomla 3.4
<?php
const _JEXEC = 1;
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
require_once dirname(__DIR__) . '/defines.php';
}
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', dirname(__DIR__));
require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_LIBRARIES . '/import.legacy.php';
require_once JPATH_LIBRARIES . '/cms.php';
require_once JPATH_CONFIGURATION . '/configuration.php';
class AddArticle extends JApplicationCli
{
public function doExecute()
{
$count = 10;
while ($count > 0)
{
$count--;
$jarticle = new stdClass();
$jarticle->title = 'New article added programmatically' . rand();
$jarticle->introtext = '<p>A programmatically created article</p>';
$table = JTable::getInstance('content', 'JTable');
$data = (array)$jarticle;
// Bind data
if (!$table->bind($data))
{
die('bind error');
return false;
}
// Check the data.
if (!$table->check())
{
die('check error');
return false;
}
// Store the data.
if (!$table->store())
{
die('store error');
return false;
}
}
}
}
JApplicationCli::getInstance('AddArticle')->execute();
I was able to find the answer to this as it had been raised as an issue at github, so I am posting that solution here.
https://github.com/joomla/joomla-cms/issues/7028
It is necessary to register the application like this, if the command line app uses JTable:
class MakeSql extends JApplicationCli
{
public function __construct()
{
parent::__construct();
JFactory::$application = $this; // this is necessary if using JTable
}
public function doExecute()
{
$db = JFactory::getDbo();
// ... etc etc ...
I did this and it worked fine.

JFactory failing to import

I am trying to make a login system for an android application that works in with my 2.5 Joomla website. I am trying to do this by making a Joomla plugin which the android application sends post data to a php file which that then authenticates the user to see if the credentials are correct or not for the login. I have been trying to get this working all afternoon but it seems all my attempts of importing JFactory are failing.
I have the below code which bugs out at the first mention of JFactory. My attempt of importing it is not working either.
<?php
//needed to be commented out otherwise the android application cannot send data to the file
//defined('_JEXEC') or die;
define('_JREQUEST_NO_CLEAN', 1);
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
if (file_exists(dirname(__FILE__) . '/defines.php')) {
include_once dirname(__FILE__) . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(__FILE__));
require_once JPATH_BASE.'/includes/defines.php';
}
require_once JPATH_BASE.'/includes/framework.php';
require_once JPATH_BASE.'/includes/helper.php';
require_once JPATH_BASE.'/includes/toolbar.php';
require JPATH_BASE.'/library/joomla/factory.php';
$email = $_POST['email'];
$password = $_POST['password'];
file_put_contents("Log.txt", "got data: ".$email." and ".$password);
$credentials->email = $email;
$credentials->password = $password;
$responce;
//error occurs here
$db = JFactory::getDbo();
...
?>
I have looked at these other questions about importing JFactory but none of them are working for me:
- JFactory,JDatabase class not found in /var/www/joomla2.5/database.php
- Class 'JFactory' not found
- include Jfactory class in an external php file, Joomla
So my simplified question is how do I import JFactory or at least work around it in this situation? Anyone feeling smarter than me who would be so kind to answer the question :)
General Information:
running php 5.1.13
Joomla 2.5
Testing on wamp server (localhost)
I suggest to go the official Joomla way and bootstrap an application. What I did works pretty well and is the recommended Joomla way (I haven't tested the code below but it should give you a starting point as it was a copy paste from multiple sources in my code).
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', 1);
define('JPATH_BASE', dirname(dirname(dirname(__FILE__))));
require_once JPATH_BASE.DS.'includes'.DS.'defines.php';
require JPATH_LIBRARIES.DS.'import.php';
require JPATH_LIBRARIES.DS.'cms.php';
JLoader::import('joomla.user.authentication');
JLoader::import('joomla.application.component.helper');
class MyJoomlaServer extends JApplicationWeb {
public function doExecute() {
$config = JFactory::getConfig();
$email = $_POST['email'];
$password = $_POST['password'];
$user = ...;//get the user with the email
file_put_contents("Log.txt", "got data: ".$email." and ".$password);
$authenticate = JAuthentication::getInstance();
$response = $authenticate->authenticate(array('username' => $user->username, 'password' => $password));
return $response->status === JAuthentication::STATUS_SUCCESS;
}
public function isAdmin() {
return false;
}
}
$app = JApplicationWeb::getInstance('MyJoomlaServer');
JFactory::$application = $app;
$app->execute();
Something along the lines works for me. More platform examples can be found here https://github.com/joomla/joomla-platform-examples/tree/master/web.
try this,
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );//this is when we are in the 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();
$db = JFactory::getDbo();
It will work, you missed JFactory::getApplication('site');
Hope it helps..

Zend Framework Cron for FIFO Queue

I am trying to run a cron job in my application my set up is like this:
My zend application Version 1.12
inside my public/index.php
function Mylib_init_settings($settings, $environment)
{
if (getenv('LOCAL_ENV') && file_exists($serverConfigFile = __DIR__ . '/../application/configs/' . getenv('LOCAL_ENV') . '.ini')) {
$settings->addOverrideFile($serverConfigFile);
}
}
define('MYLIB_APPLICATION_ENV', 'production');
require __DIR__ . '/../library/Mylib/Application/start.php';
Inside Start.php
<?php
use Mylib\Config;
use Mylib\Config\Loader\SecondGeneration;
function mylib_trigger_hook($hook, $params = array())
{
$func = 'mylib_init_' . strtolower(trim($hook));
if (function_exists($func)) {
call_user_func_array($func, $params);
}
}
// ---------------------------------------------------------------------------------------------------------------------
// setup application constants
if (getenv('SELENIUM')) {
defined('MYLIB_APPLICATION_ENV')
?: define('MYLIB_APPLICATION_ENV', 'testing');
}
// should the application be bootstrapped?
defined('MYLIB_APPLICATION_BOOTSTRAP')
?: define('MYLIB_APPLICATION_BOOTSTRAP', true);
// should the application run?
defined('MYLIB_APPLICATION_CREATE')
?: define('MYLIB_APPLICATION_CREATE', true);
// should the application run?
defined('MYLIB_APPLICATION_RUN')
?: define('MYLIB_APPLICATION_RUN', true);
// maximum execution time
defined('MYLIB_APPLICATION_TIME_LIMIT')
?: define('MYLIB_APPLICATION_TIME_LIMIT', 0);
// path to application rooth
defined('MYLIB_APPLICATION_PATH_ROOT')
?: define('MYLIB_APPLICATION_PATH_ROOT', realpath(__DIR__ . '/../../../'));
// path to library
defined('MYLIB_APPLICATION_PATH_LIBRARY')
?: define('MYLIB_APPLICATION_PATH_LIBRARY', realpath(__DIR__ . '/../../'));
mylib_trigger_hook('constants');
// ---------------------------------------------------------------------------------------------------------------------
// limits the maximum execution time
set_time_limit(MYLIB_APPLICATION_TIME_LIMIT);
// ---------------------------------------------------------------------------------------------------------------------
// determine which configuration section, and overrides to load
$configSection = defined('MYLIB_APPLICATION_ENV') ?MYLIB_APPLICATION_ENV : null;
$configOverride = null;
$environmentFilename = MYLIB_APPLICATION_PATH_ROOT . '/environment';
if (file_exists($environmentFilename)) {
$ini = parse_ini_file($environmentFilename);
if ($ini === false) {
throw new \RuntimeException('Failed to parse enviroment file: ' . $environmentFilename);
}
if (!defined('MYLIB_APPLICATION_ENV')) {
// should have at least a config.section variable
if (!isset($ini['config.section'])) {
throw new \RuntimeException('\'config.section\' setting is missing in environment file');
}
$configSection = $ini['config.section'];
}
if (isset($ini['config.override'])) {
$configOverrideFilename = MYLIB_APPLICATION_PATH_ROOT . '/application/configs/' . $ini['config.override'] . '.ini';
if (!is_readable($configOverrideFilename)) {
throw new \RuntimeException(
sprintf('You have provided a config override file (%s), but it is not readable', $configOverrideFilename)
);
} else {
$configOverride = $configOverrideFilename;
}
}
}
defined('MYLIB_APPLICATION_ENV')
?: define('MYLIB_APPLICATION_ENV', $configSection);
static $allowedEnvironmnets = array(
'production',
'staging',
'testing',
'development',
);
if (!in_array(MYLIB_APPLICATION_ENV, $allowedEnvironmnets)) {
throw new \RuntimeException(
sprintf('Invalid environment %s provided. Must be either of: %s', MYLIB_APPLICATION_ENV, implode(', ', $allowedEnvironmnets))
);
}
macq_trigger_hook('environment', array(MYLIB_APPLICATION_ENV));
// ---------------------------------------------------------------------------------------------------------------------
// set the include path
set_include_path(MYLIB_APPLICATION_PATH_LIBRARY . PATH_SEPARATOR . get_include_path());
mylib_trigger_hook('includepath', array(get_include_path()));
// ---------------------------------------------------------------------------------------------------------------------
// enable PSR-0 autoloading
require_once MYLIB_APPLICATION_PATH_LIBRARY . '/Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()
->setFallbackAutoloader(true);
// ---------------------------------------------------------------------------------------------------------------------
// load configuration settings, and if an override is specified, merge it
$settings = new SecondGeneration(
MYLIB_APPLICATION_PATH_ROOT,
MYLIB_APPLICATION_ENV,
MYLIB_APPLICATION_PATH_LIBRARY . '/MyLib/Application/configuration.ini'
);
if ($configOverride) {
$settings->addOverrideFile($configOverride);
}
// set up config file caching, this is a seperate cache then any application caches created!
if (isset($ini['config.cache.enabled']) && $ini['config.cache.enabled']) {
if (isset($ini['config.cache.dir']) && is_writable($ini['config.cache.dir'])) {
$configCache = new Zend_Cache_Core(array('automatic_serialization'=>true));
$backend = new Zend_Cache_Backend_File(array(
'cache_dir' => $ini['config.cache.dir'],
));
$configCache->setBackend($backend);
$settings->setCache($configCache);
unset($configCache, $backend);
} else {
throw new \RuntimeException(
sprintf('Configuration cache is enabled, but no correct cache dir is specified, or the specified directory is not writable')
);
}
}
// load configuration settings
Config::load($settings);
mylib_trigger_hook('settings', array($settings, MYLIB_APPLICATION_ENV));
// ---------------------------------------------------------------------------------------------------------------------
// create application and bootstrap
if (MYLIB_APPLICATION_CREATE) {
$application = new Zend_Application(Config::environment(), Config::config());
macq_trigger_hook('application', array($application));
if (MYLIB_APPLICATION_BOOTSTRAP) {
$application->bootstrap();
macq_trigger_hook('bootstrap', array($application));
}
// ---------------------------------------------------------------------------------------------------------------------
// run application?
if (MYLIB_APPLICATION_RUN) {
$application->run();
macq_trigger_hook('run', array($application));
}
}
What I did is :
I followed the following link:
http://www.magentozend.com/blog/2012/02/03/setting-up-cronjobs-for-zend-framework-envoirment/
what I did is create a "cron" folder at the level in which my application folders are present.
inside the folder created init.php file inside that I added my index.php code and start.php code.
and my controller file is as like this:
application/modules/myproject/controller/cronjop.php
inside the cron job file I just called init.php
by
require_once('/../../../../cron/init.php');
but the cron is not working can some one help me..
thanks in advance..
I see you miss the point of using Cron and Zend as well. Zend site is just normal site so you can use for example lynx browser to run the site.
*/10 * * * * lynx -dump http://www.myzendsite.com/mycontroller/mycronaction
just create My Controller add mycron Action and put in this method what you want cron to do. Lynx will open it as normal user would do. Cron will run lynx after some time.
The line */10 means every 10 minutes. You can fit it to your needs.
There are other ways to run php script for example via php parser or curl.
Check this tutorial

Joomla 1.6 External PHP Interaction Issue

I am new to working with Joomla and I am adapting an external php class I wrote for v1.5.
Without going into all the details, basically, I use a function to load the Joomla environment after which everything in Joomla is available to the class.
This is essentially done using the index.php file.
It works fine with v1.5 and has done for a while but trying to adapt it for v1.6, it falls over.
Here is the function:
private function loadJoomla() {
$path_base = rtrim($this->joomFullPath, '/');
// Set flag that this is a parent file
define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
switch ($joomlaVersion) {
case 'v1.6':
if (file_exists($path_base . '/defines.php')) {
include_once $path_base . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', $path_base);
require_once JPATH_BASE.'/includes/defines.php';
}
require_once JPATH_BASE.'/includes/framework.php';
// Mark afterLoad in the profiler.
JDEBUG ? $_PROFILER->mark('afterLoad') : null;
// Instantiate the application.
$app = JFactory::getApplication('site');
// Initialise the application.
$app->initialise();
// Mark afterIntialise in the profiler.
JDEBUG ? $_PROFILER->mark('afterInitialise') : null;
// Route the application.
$app->route();
// Mark afterRoute in the profiler.
JDEBUG ? $_PROFILER->mark('afterRoute') : null;
// Dispatch the application.
$app->dispatch();
// Mark afterDispatch in the profiler.
JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
// Render the application.
$app->render();
// Mark afterRender in the profiler.
JDEBUG ? $_PROFILER->mark('afterRender') : null;
// Return the response.
return $app;
break;
case 'v1.5':
// PREPARE
define('JPATH_BASE', $path_base);
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
JDEBUG ? $_PROFILER->mark( 'afterLoad' ) : NULL;
// CREATE THE APPLICATION
$GLOBALS['mainframe'] =& JFactory::getApplication('site');
// INITIALISE THE APPLICATION
/* set the language */
$GLOBALS['mainframe']->initialise();
JPluginHelper::importPlugin('system');
/* trigger the onAfterInitialise events */
JDEBUG ? $_PROFILER->mark('afterInitialise') : NULL;
$GLOBALS['mainframe']->triggerEvent('onAfterInitialise');
// ROUTE THE APPLICATION
$GLOBALS['mainframe']->route();
/* authorization */
$GLOBALS['Itemid'] = JRequest::getInt( 'Itemid');
$GLOBALS['mainframe']->authorize($GLOBALS['Itemid']);
/* trigger the onAfterRoute events */
JDEBUG ? $_PROFILER->mark('afterRoute') : NULL;
$GLOBALS['mainframe']->triggerEvent('onAfterRoute');
// DISPATCH THE APPLICATION
$GLOBALS['option'] = JRequest::getCmd('option');
$GLOBALS['mainframe']->dispatch($GLOBALS['option']);
/* trigger the onAfterDispatch events */
JDEBUG ? $_PROFILER->mark('afterDispatch') : NULL;
$GLOBALS['mainframe']->triggerEvent('onAfterDispatch');
// RENDER THE APPLICATION
$GLOBALS['mainframe']->render();
/* trigger the onAfterRender events */
JDEBUG ? $_PROFILER->mark('afterRender') : NULL;
$GLOBALS['mainframe']->triggerEvent('onAfterRender');
// RETURN THE RESPONSE
return JResponse::toString($GLOBALS['mainframe']->getCfg('gzip'));
break;
default:
return NULL;
break;
}
As said, the v1.5 bit works fine and is just the index.php file with the mainframe variable made global. The v1.6 bit falls over at '$app->dispatch();'.
Debugging the flow using 'die' took me to function dispatch in /libraries/joomla/application.php where I found that the fall over point was '$contents = JComponentHelper::renderComponent($component);' which took me to function renderComponent in /libraries/joomla/application/component/helper.php
A few 'dies' later, I found the fall over point to be, wait for it, 'ob_start();'.
Completely baffled especially since checking in v1.5 code, I can see it is exactly the same as v1.6 here.
I suspect the $app scope may be the reason behind this and will appreciate some help. I tried the obvious "$GLOBALS['app']" with no joy.
Thanks for taking the time and pointers appreciated.
I managed to solve this problem as follows.
There were two separate issues happening.
Firstly, The v1.6 section did not have the "$option" parameter properly initialised. Thanks to user hbit in this query I made, I was able to solve that. by changing the code as follows:
// Dispatch the application.
$option = JRequest::getCmd('option');
$app->dispatch($option);
However, that did not solve the issue and the code was still crashing at the 'ob_start' point.
Secondly, I couldn't get to the actual reason for the crash but went for a workaround. Since the ob_start bit in question, located in /libraries/joomla/application/component/helper.php, is only there to gather a component output into a variable, I worked around it by pulling the code that '$app->dispatch($option)' fires into my file and amended the problem section.
First, I modified the main section as follows:
// Dispatch the application.
$option = JRequest::getCmd('option');
/** The process crashes here for some reason
* (See https://stackoverflow.com/questions/7039162/).
* So we comment out the Joomla! function, pull the code in here and
* push the component content into the Joomla document buffer ourselves.
**/
//$app->dispatch($option);
$this->joomdispatch($option);
I then wrote a 'joomdispatch' function as follows:
private function joomdispatch($option) {
/************************
* This is pulled from function 'render'
* in /libraries/joomla/application.php
************************/
$document = JFactory::getDocument();
$document->setTitle(JApplication::getCfg('sitename'). ' - ' .JText::_('JADMINISTRATION'));
$document->setDescription(JApplication::getCfg('MetaDesc'));
/************************
* This is pulled from function 'renderComponent'
* in /libraries/joomla/application/component/helper.php
* Function 'renderComponent' is called by the
* '$contents = JComponentHelper::renderComponent($component);' line
* We exclude that line and jump to the function code
************************/
// Initialise variables.
$app = JFactory::getApplication();
// Load template language files.
$template = $app->getTemplate(true)->template;
$lang = JFactory::getLanguage();
$lang->load('tpl_'.$template, JPATH_BASE, null, false, false)
|| $lang->load('tpl_'.$template, JPATH_THEMES."/$template", null, false, false)
|| $lang->load('tpl_'.$template, JPATH_BASE, $lang->getDefault(), false, false)
|| $lang->load('tpl_'.$template, JPATH_THEMES."/$template", $lang->getDefault(), false, false);
$scope = $app->scope; //record the scope
$app->scope = $option; //set scope to component name
// Build the component path.
$option = preg_replace('/[^A-Z0-9_\.-]/i', '', $option);
$file = substr($option, 4);
// Define component path.
define('JPATH_COMPONENT', JPATH_BASE.DS.'components'.DS.$option);
define('JPATH_COMPONENT_SITE', JPATH_SITE.DS.'components'.DS.$option);
define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR.DS.'components'.DS.$option);
// get component path
if ($app->isAdmin() && file_exists(JPATH_COMPONENT.DS.'admin.'.$file.'.php')) {
$path = JPATH_COMPONENT.DS.'admin.'.$file.'.php';
} else {
$path = JPATH_COMPONENT.DS.$file.'.php';
}
$task = JRequest::getString('task');
// Load common and local language files.
$lang->load($option, JPATH_BASE, null, false, false)
|| $lang->load($option, JPATH_COMPONENT, null, false, false)
|| $lang->load($option, JPATH_BASE, $lang->getDefault(), false, false)
|| $lang->load($option, JPATH_COMPONENT, $lang->getDefault(), false, false);
// Handle template preview outlining.
$contents = null;
// Get component html
/************************
* This has been edited from the native 'ob_start'.
* Could use curl as well
***********************/
$contents = file_get_contents($this->joomUrl . '/index.php?' . $this->joomQS);
// Build the component toolbar
jimport('joomla.application.helper');
if (($path = JApplicationHelper::getPath('toolbar')) && $app->isAdmin()) {
// Get the task again, in case it has changed
$task = JRequest::getString('task');
// Make the toolbar
include_once $path;
}
$app->scope = $scope; //revert the scope
/************************
* Back to function 'renderComponent' code
* to complete process
************************/
$document->setBuffer($contents, 'component');
// Trigger the onAfterDispatch event.
JPluginHelper::importPlugin('system');
JApplication::triggerEvent('onAfterDispatch');
}
With this, everything works fine. Didn't get to the bottom of the (strange) error but managed to get around it.

Categories