Welcome Guest, Not a member yet? Register   Sign In
URI localization: Translating the uri-segments
#10

[eluser]Nalorin[/eluser]
Thanks for your response, Fabdrol.

Your code looks like it will do the work I need, but may do one thing that is undesirable - redirect the user's browser. I was hoping to have this function transparently, similar to an internal redirect using rewriting.

Here's what I was hoping to accomplish, assuming a URL of www.mysite.com/chicago/fruit/pear/123

Left column is the URI shown in the user's browser. Right column is the URI the server is working with.

Code:
1) '/chicago/fruit/pear/123'    '/chicago/fruit/pear/123'
2) '/chicago/fruit/pear/123'    '/fruit/pear/123'
3) '/chicago/fruit/pear/123'    ''// Output sent. Apache thread terminates
Step 1: Server receives URI request from browser
Step 2: Server parses URI and extracts city, then continues executing category controller
Step 3: Script execution completes, thread is destroyed, server waits to receive new request

This way, if the user doesn't find what they want in chicago, they can simply change the city to milwaukee to see if what they're looking for is there:
Code:
'www.mysite.com/milwaukee/fruit/pear/123'
and the page is loaded with the new city's results

Is it better (or even possible) to grab the city from the URL as a hook or something, store it as a variable, and then load that variable (eg. $city) from the controller's constructor? Or, is it possible to adapt your method to have it function like this?


Messages In This Thread
URI localization: Translating the uri-segments - by El Forum - 12-02-2009, 04:39 AM
URI localization: Translating the uri-segments - by El Forum - 12-02-2009, 05:30 AM
URI localization: Translating the uri-segments - by El Forum - 12-02-2009, 06:17 AM
URI localization: Translating the uri-segments - by El Forum - 12-02-2009, 06:54 AM
URI localization: Translating the uri-segments - by El Forum - 12-02-2009, 07:43 AM
URI localization: Translating the uri-segments - by El Forum - 12-02-2009, 08:17 AM
URI localization: Translating the uri-segments - by El Forum - 12-02-2009, 10:27 AM
URI localization: Translating the uri-segments - by El Forum - 08-11-2010, 03:03 PM
URI localization: Translating the uri-segments - by El Forum - 08-11-2010, 04:20 PM
URI localization: Translating the uri-segments - by El Forum - 08-11-2010, 04:58 PM
URI localization: Translating the uri-segments - by El Forum - 08-11-2010, 10:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB