500 - Unable to load router

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
kwylez
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Sep 26, 2007 1:59 am
Contact:

500 - Unable to load router

Post by kwylez » Wed Mar 12, 2008 9:52 pm

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();
}

greatwitenorth
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Nov 14, 2007 5:50 am

Re: 500 - Unable to load router

Post by greatwitenorth » Thu Mar 13, 2008 6:06 am

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.

kwylez
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Sep 26, 2007 1:59 am
Contact:

Re: 500 - Unable to load router

Post by kwylez » Thu Mar 13, 2008 3:18 pm

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.


Post Reply