Skip to content

Instantly share code, notes, and snippets.

@SDKiller
Last active August 29, 2015 14:12
Show Gist options
  • Save SDKiller/58d19f5839569a9655f7 to your computer and use it in GitHub Desktop.
Save SDKiller/58d19f5839569a9655f7 to your computer and use it in GitHub Desktop.
Example usage
<?php
/**
* @author SDKiller
* @copyright Copyright (C) 2015 SDKiller, http://jexy.ru. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
require_once dirname(__FILE__) . '/MyCoolRouter.php';
class PlgSystemCustomroute extends JPlugin
{
/**
* @throws Exception
*/
public function onAfterInitialise()
{
$app = JFactory::getApplication();
if (!$app->isSite()) {
return true;
}
//set router override
/** @var $router \JRouterSite */
$router = $app::getRouter();
$crouter = new MyCoolRouter();
$router->setComponentRouter('com_content', $crouter);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment