Many thanks Anthony and Richard, I'll use your suggestion.

Greetings.

El 29/03/16 a las 10:27, Richard Vézina escribió:
I agree with Anthony... Do you have any constraint that prevent you from doing that... I would definetly stay away from router as much as I can...

Richard

On Tue, Mar 29, 2016 at 9:37 AM, Anthony <abasta...@gmail.com <mailto:abasta...@gmail.com>> wrote:

        Right now the url to reach the index function of the country
        controller is something like www.myapp.com/country/cuba
        <http://www.myapp.com/country/cuba> because index is set as
        the default function using the parametric router
        (www.myapp.com/country/index/cuba
        <http://www.myapp.com/country/index/cuba> without set index()
        as default).


        Now I need to find a way to map

        www.myapp.com/country/index/cuba
        <http://www.myapp.com/country/index/cuba> from
        www.myapp.com/cuba <http://www.myapp.com/cuba>
        www.myapp.com/state/index/cuba/cienfuegos
        <http://www.myapp.com/state/index/cuba/cienfuegos> from
        www.myapp.com/cuba/cienfuegos
        <http://www.myapp.com/cuba/cienfuegos>
        www.myapp.com/city/index/cuba/cienfuegos/cienfuegos
        <http://www.myapp.com/city/index/cuba/cienfuegos/cienfuegos>
        from www.myapp.com/cuba/cienfuegos/cienfuegos
        <http://www.myapp.com/cuba/cienfuegos/cienfuegos>


    I don't think you want to use URL rewrite rules to achieve this,
    as it will be very complex to set up and maintain. Given the above
    requirements, I think my earlier proposal makes much more sense --
    just have a single controller with a single function:

    |
    defindex():
        country,state,city
    =request.args(0),request.args(1),request.args(2)
    ifcity:
            data =get_city_data(country,state,city)
            response.view ='default/city_view.html'
    elifstate:
            data =get_state_data(country,state)
            response.view ='default/state_view.html'
    elifcountry:
            data =get_country_data(country)
            response.view ='default/country_view.html'
    ...
    |

    Of course, the details of you implement the internal logic will
    depend on exactly how different the code is for country vs. state
    vs. city.

    Anthony
-- 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
    <mailto: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 <mailto:web2py+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.



--
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.

Reply via email to