Page 1 of 1

500 - Unable to load router

Posted: Wed Mar 12, 2008 9:52 pm
by kwylez
I have a system plugin that I need to parse the current URL, but when I try to instantiate the joomla application router I get the following error:

500 - Unable to load router

I am using the method onAfterInitialise

Code: Select all

function onAfterInitialise() {
  $router = &JApplication::getRouter();
}

Re: 500 - Unable to load router

Posted: Thu Mar 13, 2008 6:06 am
by greatwitenorth
i just installed ATRIO sef and i got this problem. I uninstalled the plugin but that didn't help (although it did remove the files) the problem was that is modified libraries>joomla>applpication>router.php

I just downloaded the full joomla 1.5.1 installation again, unzipped it, navigated to this file and used it to replace the one on my web server. this fixed the problem for me. hope this helps.

Re: 500 - Unable to load router

Posted: Thu Mar 13, 2008 3:18 pm
by kwylez
Unfortunately this didn't fix my problem, but I did look at the smartsef plugin code and borrowed some of their logic which seemed to work. After working with some other possible solutions and looking at the joomla library router class things started to make sense.

Here is what worked for me:

Code: Select all

$logentry = array();
$log        = &JLog::getInstance();
global $mainframe;
$uri       = &JURI::getInstance();
$router  = &$mainframe->getRouter();

$logentry["comment"] = "URI to string {$router->parse($uri)}";
    foreach ($router->parse($uri) as $key => $value):
      $logentry["comment"] = "Key {$key} : Value {$value}";
      $log->addEntry($logentry);
    endforeach;
    $log->addEntry($logentry);
There is still a small bug though with the logic because when I view any of my pages I get incorrect urls for any links on the page:

/* incorrect */
http://cwiles.stjude.sjcrh.localseo-cat ... ayout.html

/* correct link */
http://cwiles.stjude.sjcrh.local/seo-ca ... ayout.html

If I remove the line $router->parse($uri) the links are on my pages are correct.