Gideon So Posted November 6, 2018 Posted November 6, 2018 Hi, i have two branches in the page tree as the following: home -branch 1 --page 1 --page 2 -branch 2 --page 3 --page 4 I have two languages enabled in the home page "lang1 and lang2" The url generated is http://mysite.com/lang1/branch1/page1/ I want to have the url generated as http://mysite.com/branch1/lang1/page1/ Any hints are welcome. Gideon
elabx Posted November 6, 2018 Posted November 6, 2018 I think you are going to have to use url segments on branch1, branch2 and the segments being the language names.
Gideon So Posted November 6, 2018 Author Posted November 6, 2018 I am not very familiar with url segment. Any hints??
elabx Posted November 6, 2018 Posted November 6, 2018 Check this out my friend: https://processwire.com/docs/tutorials/how-to-use-url-segments/ It's basically a way to not follow the routing of the page tree, so you can make up any possible route, and prepare your template's code for it, imagine this exist in the template file branch.php: <?php if($page->urlSegment1 == "es"){ $user->language = $languages->get('es'); // field output will be in spanish! }elseif($page->urlSemgent1 == "en"){ $user->language = $languages->get('en'); // fields will output in english! } I'm just not sure how multilang works without the root language segment.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now