kkalgidim Posted June 18, 2019 Posted June 18, 2019 <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <?php foreach($pages->get("/treatments/")->children as $t) { $count = $pages->count("template=clinic, cliniclocation=$page->id, treatmentprice.clinictreatments=$t->id"); if ($count!=0){ echo "<a class='dropdown-item' href='$page->url$t->name'>$t->title ($count)</a>";} } ?> </div> Hi you see code above. Its a multi language web site. When i change the language instead of default language, url section ( t->name ) not change! for ex: default language english http://www.domain.com/en/locations/turkey/dental-implant select turkish language http://www.domain.com/tr/konumlar/turkey/dental-implant it must be http://www.domain.com/tr/konumlar/turkey/dis-implanti if i use $t->title instead of $t->name translation works fine but not as url. as usual it echoes title it look like http://www.domain.com/tr/konumlar/turkey/Dis Implati if i use $t->url it echo konumlar/turkey/dis-implati so if i get last segment of url it will works fine. What can i do for that?
flydev Posted June 18, 2019 Posted June 18, 2019 (edited) Hi, Did you installed the following core module ? : LanguageSupportPageNames It allow you to define a specific page name for each language and editing them in the tab Page > Settings of a page. (I think you are missing this one). To answer your question : If you have URL Segment enabled on the template then you can do the following : $segments = $input->urlSegments(); echo end($segments); or $segments = explode('/', parse_url($page->url, PHP_URL_PATH)); echo end($segments); Edited June 18, 2019 by flydev screenshot / format
kkalgidim Posted June 18, 2019 Author Posted June 18, 2019 The url segment l try to get is on the sub category of treatments page so url segment is for the present page i think. I get the url of treatment url or title of treament bit i cannot get the last segment of treatment url
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