Page LHandles
This is an open discussion with 119 replies, filed under Extensions.
Search
deleted
deleted
@vladG: Thank you very much for your clarification :)
LanguageRedirect::instance()->getLanguageCode() is used to get the whole language code (including region: en-us).
This is what I want 'en' if no region, 'en-us' if region is set... I used it for SQL queries so it should be ok
@vladG: I do have the data source included, but it doesn't work. I get the following XML:
<plh-page> <page handle="" id=""> <item lang="zh" handle="" /> <item lang="en" handle="" /> </page> </plh-page>
I have already entered the page titles and handles.
I have the latest Page LHandles and Language Redirect.
Edit
Ok, the problem is that it won't work on the index page. I.e. going to /xx/home/ works but /xx/ index page won't work.
@Pat
If someone requires www.mysite.com
, then, if set, the default index
page will be returned. PLH doesn't know which page is the current index page, so no information in this case will be returned.
For now, I didn't notice any situations where this information is required.
Ah ok. I guess I just don't need to write "Home" in the title on the home page then. :)
Pat, you're right, a homepage on a multi lingual site should be available in both languages, nd default to one with redirects. If I were to visit www.demo.com/
which defaulted to en
I would expect a redirect to www.demo.com/en/
with an option to switch to de
for instance at www.demo.com/de/
.
This can be achieved with the URL Router extension (I think, not tested) with three routes...
From: ^$ To: ^en/$ From: ^en/$ To: ^en/home/$ From: ^de/$ To: ^de/home/$
Set it to display content under legacy url too.
@designermonkey: Well, I use Language Redirect, which does just that (except Page LHandles doesn't show the localized handles for the index page).
@Pat: Just read this post after writting to you in Github. Have a look at the breadcrumb extension. It will work like this: You won't get any results on the home page (not empty nodes, not nodes at all) you will know for sure you are on the home page. I have written compatibility code with LR in the breadcrumb ext.
@Pat
except Page LHandles doesn't show the localized handles for the index page
False. It translates all page handles, including index. I have the company
page as index.
My urls:
www.mysite.com/ro/companie www.mysite.com/en/company
But, if someone requests www.mysite.com
, then a redirect takes place to www.mysite.com/{lang-code}
provided by Language Redirect. In this case there is no localized page handle because ... no page handle is set in the URL.
@vladG: Maybe we should try to get the page tagged as index via SQL to patch this ?
Yeah, there's no page-handle in the URL, but $current-language
is available, as is $current-page
.
@vladG: We could use the $current-page
handle to get the translated version as @Pat suggested... Let me know what you prefer and I will code it.
I'm back :) Was in vacation.
@Nitiques
We could use the $current-page handle to get the translated version as @Pat suggested... Let me know what you prefer and I will code it.
Feel free to do it. I'll merge your changes.
@vladG: Super ! I will do that next week, since I leave for 3 days today :)
This is an XSLT related question with Page L handles:
How would I target the current handle of the currently active langauge for use in url param?
This is what I have so far:
/data/plh-page/page/item[@lang = '$url-language']/@handle
But it doesn't match to the current page handle at all? I'm trying to get to the handle node of the parent page in this XML:
<plh-page> <page handle="tywydd-a-gofod" id="17"> <item lang="cy" handle="tywydd-a-gofod">Tywydd A Gofod</item> <item lang="en" handle="weather-and-space">Weather & Space</item> <page handle="gofod" id="23"> <item lang="cy" handle="gofod">Gofod</item> <item lang="en" handle="space">Space</item> </page> </page> </plh-page>
Thoughts please :)
My bad..created my own var and filtered on that:
/data/plh-page/page/item[@lang = $lang]/@handle
Sorted.
Regarding this post:
Yes, that's the order ... grand-parent -> parent -> current-page
I'll release an XSLT utility tonight (around 23:00 GMT) which will cover some url generation and stuff like that.
oooh :)
@VladG, did you release anything in the end? just curious :)
Create an account or sign in to comment.
@nitriques
Take a look at my previous post. I corrected it since it had errors.
LanguageRedirect::instance()->getLanguage()
is used to get the 'language' parameterand
LanguageRedirect::instance()->getLanguageCode()
is used to get the whole language code (including region:en-us
).You said earlier:
No need to change this. You are using it correctly.