I have a website that the user can read both in Italian and English language.
The English website is characterized by the following path: mysite.com/…
While the Italian one has the following path: mysite.com/it/…
I am now implementing a booking module that should be displayed only in the home and in the “Fares” pages in order to provide the user a tool to reserve a spot for the service I offer (taxi services). The module is connected to a Database containing the cities (departures and arrivals) and the related prices. For module I mean a box where you are asked some information (in my case: Departure, arrival, # of passengers and # of luggages), you press a button and something happen (in my case you query the database getting the price of the trip).
Since the website has two languages I need to translate both the module and the database as well. I proceeded in the following way:
- I created two folders containing the same module but one is in Italian while the other is in English;
- Each module queries the correct database, the Italian module takes the data from the Italian DB while the English module read the data from the translated one (es. Malpensa Aeroporto -> Malpensa Airport).
What I would like to do now is to create an if statement that does the following:
IF (on the homepage of mysite.com/) {
Get the English module
} else IF (on the homepage of mysite.com/it/) {
Get the Italian module
} else {
Do nothing because you are not on any homepage
}
I already have searched in the blog and around the internet but I am not able to find something working. How can I develop this "IF statement"?
Thank you all
Aucun commentaire:
Enregistrer un commentaire