Router for root components
-
Hi all,
I recently needed to code some root components for a project of mine, and after figuring out how and where to hook in order to get them registered I came up with the idea of creating a router for them. For those who’ve gone digging you know that Buddypress does it’s own URL handling which isn’t dependent on what’s in the database. However the separate screen functions (BPs controllers) decide what URL to act on. This means that every screen function has to look at the URL and decide if it’s a go or a no go.
I have written a router that handles this for you. As long as you follow the conventions (which I’d like to discuss) it will handle the rest for you. This means that all you have to do is define the screen functions and the router will run them for you given the correct URL. If it doesn’t find a screen function it will go looking for a template with that name in your themes folder (component subdir of course). If you want to do your own thing then that’s not a problem either, just hook your screen function in the same way as Buddypress own root components do it and the routers standard behaviour will be overridden.
I would of course love to share but I’m unsure how big the want/need for this kind of plugin is. So is there anyone else out there writing root components who feels like this might be a good idea?
- The topic ‘Router for root components’ is closed to new replies.