New web router

121 views
Skip to first unread message

Stefan Neculai

unread,
Jun 17, 2012, 7:52:10 PM6/17/12
to joomla-de...@googlegroups.com
Hi,

As a part of my GSoC project, I am working with the new router. I have used the following map and I was wondering if there is an easier way to do it (without changing the current parseRoute method from JApplicationWebRouterBase). I am asking this because I will need such mappings for all type of contents used in the API.

$this->router->addMap('/content', 'content');       match all the content with the content controller
$this->router->addMap('/content/*', 'content');     match a specific content with the content controller

--
Thanks,
Stefan

Sam Moffatt

unread,
Jun 18, 2012, 11:38:58 PM6/18/12
to joomla-de...@googlegroups.com
You might get more help if you provide more details about what you're
doing, what you're trying to solve, why in detail this is a problem
and some background on the project. I certainly have no idea what
you're after, why you think changing parseRoute would provide a
solution or what you mean by "easier way to do it".

Cheers,

Sam Moffatt
http://pasamio.id.au

Stefan Neculai

unread,
Jun 19, 2012, 3:07:58 AM6/19/12
to joomla-de...@googlegroups.com
Hi,

I need to add more rules like the following ones:
$this->router->addMap('/content', 'content'); 
$this->router->addMap('/content/:content_id', 'content'); 
$this->router->addMap('/applications', 'applications'); 
$this->router->addMap('/applications/:application_id', 'applications');
$this->router->addMap('/categories', 'categories'); 
$this->router->addMap('/categories/:categories_id', 'categories');


I was wondering if there is any way to summarize somehow all these rules in a single one.

--
Thanks,
Stefan Neculai

Sent from my iPhone

Sam Moffatt

unread,
Jun 19, 2012, 3:22:41 AM6/19/12
to joomla-de...@googlegroups.com
You could create a route file and have parsed to add items or
introspect it from the database to do it that way. Perhaps I'm missing
something here. It's six routes with distinct looking parameters,
seems reasonable enough to have six different mappings.

Cheers,

Sam Moffatt
http://pasamio.id.au


Stefan Neculai

unread,
Jun 19, 2012, 3:25:24 AM6/19/12
to joomla-de...@googlegroups.com
There are more routes, not only 6 but all are the same. I asked about
sumarizing them because they are very simillar.

--
Stefan

Sent from my iPhone

Sam Moffatt

unread,
Jun 19, 2012, 3:46:05 AM6/19/12
to joomla-de...@googlegroups.com
They are similar but that doesn't mean they are the same. The new
router aims to solve one of the problems that has consistently dogged
us with the old router which is detangling that which is similar that
appears to be the same but isn't necessarily so. In this paradigm it
is very clear what goes where. This may not necessarily be suitable
for you so you might choose to build your own router that handles
requests in a way that makes more sense for your application.

Cheers,

Sam Moffatt
http://pasamio.id.au


On Tue, Jun 19, 2012 at 12:25 AM, Stefan Neculai

Stefan Neculai

unread,
Jun 19, 2012, 3:47:45 AM6/19/12
to joomla-de...@googlegroups.com
I see.. Many thanks for your help!

--
Stefan

Sent from my iPhone

Elin Waring

unread,
Jun 19, 2012, 7:55:16 AM6/19/12
to joomla-de...@googlegroups.com
Stefan,

Does that mean you are treating categories as something other than content inside a  unified content model? Is that something specific to your application's structure? 

Elin

Stefan Neculai

unread,
Jun 19, 2012, 12:32:02 PM6/19/12
to joomla-de...@googlegroups.com
Hey,

No, I treat them as a content, but I have a specific controller that extends a basic general content controller. It is needed because of some API's design constraints.

--
Stefan
Reply all
Reply to author
Forward
0 new messages