What is the nature of these controllers and the functions they contain? Do you really need separate country, city, and state controller files, or could you instead have a single function in a single controller that retrieves data for a given country, city, state depending on the set of URL args?
Anthony On Monday, March 28, 2016 at 11:46:18 AM UTC-4, Carlos Cesar Caballero wrote: > > Hi Antony, I was not clear enough... I have a country controller with a > default index function, and the same with a state controller and a city > controller, so right now: > > if I call www.myapp.com/country/cuba I get my country page for Cuba (the > index function of country controller with cuba as parameter) > if I call www.myapp.com/state/cuba/cienfuegos I get my state page for > Cienfuegos, Cuba state (the index function of state controller with cuba > and cienfuegos as parameter) > and if I call www.myapp.com/city/cuba/cienfuegos/cienfuegos I get my city > page for Cienfuegos, Cienfuegos, Cuba city (the index function of city > controller with cuba, cienfuegos, and cienfuegos as parameter) > > I need to find a way to map directly to such pages without specify > country, state or city controllers depending of the number of params. > > Greetings. > > El 28/03/16 a las 10:59, Anthony escribió: > > I think there is some confusion of terminology. In web2py, a controller is > a file in the /controllers folder, and each function in that file is an > action reachable via an HTTP request. A view is not executed independently > but associated with a particular function in a controller. With this > terminology in mind, can you detail your set of controllers and functions > and then explain how you want URLs to map to those controllers and > functions? > > Anthony > > On Monday, March 28, 2016 at 9:18:15 AM UTC-4, Carlos Cesar Caballero > wrote: >> >> Hi, I am trying to reach a routes behavior for an app but I can´t, so I >> need some tips... >> >> I have in my app countries, cities and states (or province), countries >> have states and states have cities. Each une of them have its own >> controller and view, and I want the next behavior: >> >> www.myapp.com/cuba - run country conntroller and view (for Cuba country) >> www.myapp.com/cuba/cienfuegos - run state conntroller and view (for >> Cienfuegos state of Cuba country) >> www.myapp.com/cuba/cienfuegos/cienfuegos - run city conntroller and view >> (for Cienfuegos city, Cienfuegos state of Cuba country) >> >> I will higly appreciate any help with this. >> >> Greetings. >> >> -- >> Este mensaje le ha llegado mediante el servicio de correo electronico que >> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema >> Nacional de Salud. La persona que envia este correo asume el compromiso de >> usar el servicio a tales fines y cumplir con las regulaciones establecidas >> >> Infomed: http://www.sld.cu/ >> >> -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.