Dynamic get collection page ID - Form
Permalink
Hi,
I need to be able to define ID of a page depending of the international section the visitor is in.
On homepage i have a small Check Availability form that redirect to a specific page which should be different for each language section of the website.
This is my form Action :
For exemple for English section the line is
For French i need to get this :
So i need to be able to dynamic change regarding the language this part [Page::getCollectionPathFromID(198);[/code] in the link.
Any ideas will be warm welcome.
Check this link to see what i'm talking about :
Kind regards
Chris
I need to be able to define ID of a page depending of the international section the visitor is in.
On homepage i have a small Check Availability form that redirect to a specific page which should be different for each language section of the website.
This is my form Action :
action="<?php echo DIR_REL . "/index.php" . Page::getCollectionPathFromID(198); ?>"
For exemple for English section the line is
Page::getCollectionPathFromID(198);
For French i need to get this :
Page::getCollectionPathFromID(391);
So i need to be able to dynamic change regarding the language this part [Page::getCollectionPathFromID(198);[/code] in the link.
Any ideas will be warm welcome.
Check this link to see what i'm talking about :
http://http://www.sanctuaryhotelsandresorts.com
Kind regards
Chris
Hi,
I'm not sure that's what i need.
In fact i need to test the actual language (english or french or lao or chinese) and change the form Action regarding this.
@Hutman : Thanks for this trick anyway.
Chris
I'm not sure that's what i need.
In fact i need to test the actual language (english or french or lao or chinese) and change the form Action regarding this.
@Hutman : Thanks for this trick anyway.
Chris
I think this would still work for you, you would just have to do something like this
Then you could setup each page you wanted to redirect to by the language string that will be shown in that section of the site.
If this isn't what you're looking for maybe a more clear idea of what you are trying to do would be helpful.
$languageCode = Loader::helper('section', 'multilingual')->getLanguage(); if (strlen($languageCode) === 5) { $languageCode = substr($languageCode, 0, 2); } switch($languageCode){ case 'en': $action = DIR_REL . "/index.php" . Page::getCollectionPathFromID(198); break; case 'fr': $action = DIR_REL . "/index.php" . Page::getCollectionPathFromID(391); break; } action="<?php echo $action; ?>"
Then you could setup each page you wanted to redirect to by the language string that will be shown in that section of the site.
If this isn't what you're looking for maybe a more clear idea of what you are trying to do would be helpful.
Hi,
Thanks that's i guess exactly what i need.
But i need a small more information to setup this snippet.
COuld you explain me
or this one :
This EN and FR should refere to the SubFolder of the language or should refere of the abbreviation the multilingual system is using :
Thanks in advance
Chris
Thanks that's i guess exactly what i need.
But i need a small more information to setup this snippet.
COuld you explain me
switch($languageCode){ case 'en':
or this one :
switch($languageCode){ case 'fr':
This EN and FR should refere to the SubFolder of the language or should refere of the abbreviation the multilingual system is using :
en_GB fr_FR zh_CN ... etc ...
Thanks in advance
Chris
It'll be the first two letters of the multilingual system code.
Thanks a lot, have a nice day.
Chris
Chris
This would leave you with something like "en" in the $languageCode and you could either hard code your cID based on that, or you could do a switch and put the full url link in there.