0
votes

In Joomla 1.5 when I like to call AJAX, I add function in the controller like so

global $mainframe;
        $idContact = JRequest::getVar('idContact');
        $modelContact = $this->getModel('clientcontact');
        if($modelContact->delete($idContact))
            echo "1";
        else 
            echo "0";
$mainframe->close(); 

And the controler return 1 or 0 (I dont need to use the raw or anthing else just tmpl=component in the URL)

In the 2.5 I have an error wiht $mainframe->close();

I dont like to use the raw or modal layout

1
Which Joomla are you using, your Question title says 2.5 and you refer to 1.5 in the body?Craig
I said that in the Joomla 1.5 I use that code and evrything is Ok, but I put that code in the 2.5 i got error with the close() funtion <b>Fatal error</b>: Call to a member function close() on a non-object in <b>C:\xampp\htdocs\joomla25\administrator\components\com_tktransit\controllers\client.php</b> on line <b>44</b><br />Rad

1 Answers

1
votes

global $mainframe;

Was deprecated in 1.6 and is not available in Joomla 2.5 you should read the Adapting a Joomla 1.5 extension to Joomla 2.5 article on the Joomla Doc's website.

If you're doing it the lazy way, then you can simply replace:

global $mainframe;

With:

$mainframe = JFactory::getApplication();

throughout your extension.

In addition the $option global is gone.

You may also want to bookmark the Developers portal on Joomla Doc's.