A Facebook app is hosted on my server at, say, http://server.com/projects/fbapp/, but is only ever viewed in Facebook at, for instance, http://apps.facebook.com/fbapp/.
Using CakePHP this presents a problem - should routes be prefixed with "/project/fbapp" or just "fbapp"?
It's a problem because routes are used not just for routing inbound requests, but also for generating links (and form actions etc).
As a kludge, I now have two routing instructions per route:
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::connect('projects/fbapp/pages/*', array('controller' => 'pages', 'action' => 'display'));
With the first not requiring a prefix because of a line I've included to bootstrap.php:
Configure::write('App.base', '/fbapp');
Which kicks in during reverse routing operations.
My question is whether there's a more elegant way to do this? This seems very ugly and I'm sure it's not very Cakey.