Answer the question
In order to leave comments, you need to log in
How to output different content by condition?
Good evening,
I'm making a site on MODX, and such a task arose, not an easy one (for me) - I need to make it multilingual.
I did not like the ways of all the guides, and I decided to write something simpler, and most importantly - my own.
Here's my idea:
Create tv fields (ru/en) Set the
value lang = ru/en using cookie tools (php)
Make a plug-in (switch button) that switches the value between ru/en and writes back.
Make a snippet that processes the cookie for the ru/en value, and accordingly displays the content from the desired tv field into chunks.
Chunk, in turn, is a chunk, there is no need to think about anything.
Only I already got problems when creating a cookie in a snippet)) how is it done? Help!)
Answer the question
In order to leave comments, you need to log in
I was able to implement this on localstorage, cookie js and (ajax > json > php > sql). But not all audiences have js enabled) I still need php cookies)))
The engine was broken. Reinstalling it helped.
Author! For decency, you should specify the branch (EVO-REVO), because each one has essentially been completely different engines for a long time ...
My way for the option when each language is on its own subdomain (site.ru/en.site.ru/de.site.ru /....) :
1. We put any ip definition package, I like this one sypexgeo.net
2. We determined ip - we redirect, if necessary, to the language subdomain
3. In vyshyvanka chunks we write conditions, starting from the request.
ALL!
Well, don't forget to address all subdomains to the main domain on the hosting, not all hostings are equally adequate in this regard)))
And you won't need any cookies or macos...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question