Author Topic: Use a cookie for language selection - World Template  (Read 2155 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Use a cookie for language selection - World Template
« Reply #25 on: June 02, 2021, 06:29:43 PM »
You're very welcome.   I've updated the rev date to 02-Jun-2021 and released in the distributions for all Base templates (USA,Canada,World) since the same code is used in all three (even though USA normally only has English implemented).

Template Users: use the update tool with a query of 02-Jun-2021, Base-*, *-Plugin to get a copy.  Normally, this common.php script can just be replaced, but a few may have added code there for 3rd party scripts, so that may have to be copied to the V1.12 script before uploading.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline mexbound

  • Senior Member
  • **
  • Posts: 66
Re: Use a cookie for language selection - World Template
« Reply #26 on: September 09, 2021, 10:16:43 AM »
The cookie for holding language across sessions has been working perfect. My users love it. The number one request I have now from my users is holding the "Metric/Imperial" setting across sessions. My site default is English, Imperial. I have many Canadians that want to see the site in English yet want Metric settings.  They know it is only one click away when the site opens but they wish it would remember across sessions to open in Metric settings.

Is there any "easy way" to set a cookie for the user, using the last  "Metric/Imperial" setting they chose? Then upon next time entering the site, this cookie would perform the "<script type=\"text/javascript\">ajax_changeUnits();</script>" if the cookie was saved as "Metric". If it was saved as "Imperial" then nothing needs to happen because "Imperial" is the default.

https://ajijicweather.com