Sharding app by city

Good day! I have a question to your wonderful community: We must be in the application sharing by city: etc. Each city "unique design" (logos, content) As implemented in the Phalcon without writing a controller for each city? Or is it, in this case it's the right decision?

Thank you, Phalcon!

You can set up a route so,,, etc all run the same controller & action. The route can be configured to set "city1", "city2","city3" as a variable you can access via the dispatcher. You can then update your interface accordingly.

edited Nov '14

If all that's changing between the different URLs is a view of the data, I would route everything into the same controller/action as quasipickle mentioned. You can do with a route like:

$router->add( "/{city:[a-z]+}", array( "controller" => "city", "action" => "index" ) );

However, this will catch everything like, which is likely bad. I would instead recommend you something instead like:

$router->add( "/city/{city:[a-z]+}", array( "controller" => "city", "action" => "index" ) );

This way you can still have other pages that don't conflict with city.

Note once you're in your index action, you can then render your template file using the getParam ... this will let you isolate city1 and city2 into separate templates without having to code new controllers or routes.