How to disable SEF URLs only in my custom component

For Joomla! 2.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Note: All 1.6, 1.7 and 3.5 releases have reached end of life and should be updated to 3.x.

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Locked
User avatar
CzloviekVoodka
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Feb 08, 2009 1:44 am

How to disable SEF URLs only in my custom component

Post by CzloviekVoodka » Wed Sep 05, 2012 5:26 am

Greetings.
I've made custom component for Joomla 2.5 and I have some problems with SEF urls. I know that I should write my own Router.php, however I wish to take care of it when component will be 100% functional and (as much as possible) bugless.
So my question is - how can I disable SEF URLs for my component only, but keep them for the rest of my site?
I heard that I must use JRouter::setMode(0); somewhere inside router.php file in my component's root folder, but (as my JRouter experience nearly doesn't exist) I have no idea how should I make it. Probably overwrite constructor somehow?
Please advise, I know it may looks weird - SEF URLs on whole site except one component, but currently I really need such weird configuration.

Regards. 8)

User avatar
CzloviekVoodka
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Feb 08, 2009 1:44 am

Re: How to disable SEF URLs only in my custom component

Post by CzloviekVoodka » Mon Sep 17, 2012 4:28 pm

BUMP.
Really none of you have any idea how to disable JRouter in single component? :(

User avatar
CzloviekVoodka
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Sun Feb 08, 2009 1:44 am

Re: How to disable SEF URLs only in my custom component

Post by CzloviekVoodka » Mon Sep 24, 2012 3:07 am

If anyone's interested - all I needed to do is to put this code:

Code: Select all

$app = JFactory::getApplication();
$router = $app->getRouter();
$router->setMode(0);
in component "start" file (site/COMPONENT_NAME.php) to turn off JRouter just for this one component. I just can't believe how easy it was... and can't believe that nobody here knew the answer. 8-)

User avatar
pishro
Joomla! Explorer
Joomla! Explorer
Posts: 285
Joined: Tue Oct 09, 2012 7:22 am

Re: How to disable SEF URLs only in my custom component

Post by pishro » Wed Oct 09, 2013 5:48 pm

Internally, the local part of a SEF URL (the part after the domain name) is called a route. Creating and processing SEF URLs is therefore referred to as routing, and the relevant code is called a router.
please see this links:
Supporting SEF URLs in your component
http://docs.joomla.org/Supporting_SEF_U ... _component

User avatar
yellowwebmonkey
Joomla! Explorer
Joomla! Explorer
Posts: 326
Joined: Tue Nov 17, 2009 4:22 am
Location: Central Texas
Contact:

Re: How to disable SEF URLs only in my custom component

Post by yellowwebmonkey » Mon Oct 12, 2015 2:46 pm

CzloviekVoodka, Thanks!!

For anyone else interested, this also worked by pasting into the main php file for an accordion menu I was using that was having SEF issues.


Locked

Return to “Joomla! 2.5 Coding”