UPDATED. f:link.page sometimes creates links in the wrong language - typo3

Update:
When creating a new translation for a site and call it, realURL caches the path. When you then change the title of this site a new path is generated.
The old path is still in the cache and so both path works.
Is it somehow possible to force realURL to only output the new paths, but keep the old paths so that they still work?
Old Question:
I found a strange behavior of my menu. Sometimes it creates links with the wrong links. To explain it I will create an example:
Lets say I have following sitestructure in defaultlanguge:
/the-thing/home
So for english(UK) I have the following URL:
/uk/the-thing/home
But for german I have:
/de/das-ding/home (the-thing is translated to german)
But sometimes f:link.page and f:link.typolink creates the german link with the default-structurenames. For the example above that means /de/the-thing/home.
This link will not work when I am logged in in the backend, but when I am not logged in in the backend the link works.
This not only happens in the menu, so I will not post the menu code, as it is a bit complicated. But I will post this:
<f:link.typolink parameter="{langele.language.url}" additionalParams="&L={langele.language.language}">{langele.language.languagename}</f:link.typolink>
Example values:
{langele.language.url}: 11 (page_uid)
{langele.language.language}: 2 (sys_language_uid)
{langele.language.languagename}: Just a textfield
This code is in a contentelement that creates links to other languages and is placed in the default language.
The languages are in a singletree and the translated pages have just another page title. I do not use Alternative Navigation Title. I use realURL. My realURL config is not much modified (Most of the config is for extensions, 404 handling):
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
'_DEFAULT' =>
array (
'init' =>
array (
'appendMissingSlash' => 'ifNotFile,redirect',
'emptyUrlReturnValue' => '/',
),
'pagePath' =>
array (
'rootpage_id' => '1',
),
'fileName' =>
array (
'defaultToHTMLsuffixOnPrev' => 0,
'acceptHTMLsuffix' => 1,
'index' =>
array (
'print' =>
array (
'keyValues' =>
array (
'type' => 98,
),
),
),
),
'preVars' =>
array (
0 =>
array (
'GETvar' => 'L',
'valueMap' =>
array (
'ch' => 1,
'uk' => 2,
'au' => 3,
'at' => 4,
'ca' => 5,
'hr' => 6,
'cy' => 7,
'fi' => 10,
'de' => 12,
'hu' => 13,
'it' => 15,
'sa' => 16,
'nl' => 18,
'no' => 19,
'sg' => 20,
'es' => 23,
'se' => 24,
'tr' => 26,
'ae' => 27,
'us' => 28
),
'noMatch' => 'bypass',
),
),
'postVarSets' =>
array (
'_DEFAULT' =>
array (
'news' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
),
'collection' => array(
array(
'GETvar' => 'tx_mystuff_collection[mystuff]',
'lookUpTable' => array(
'table' => 'tx_mystuff_domain_model_mystuff',
'id_field' => 'uid',
'alias_field' => 'name',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
array(
'GETvar' => 'tx_mystuff_collection[action]',
),
array(
'GETvar' => 'tx_mystuff_collection[controller]',
),
),
),
),
),
);
# 404 Errorhandling
if (preg_match('/\/ch\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 1) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/ch/404/';
} else if (preg_match('/\/gb\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 2) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/uk/404/';
} else if (preg_match('/\/au\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 3) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/au/404/';
} else if (preg_match('/\/at\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 4) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/at/404/';
} else if (preg_match('/\/ca\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 5) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/ca/404/';
} else if (preg_match('/\/hr\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 6) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/hr/404/';
} else if (preg_match('/\/cy\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 7) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/cy/404/';
} else if (preg_match('/\/fi\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 10) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/fi/404/';
} else if (preg_match('/\/de\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 12) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/de/404/';
} else if (preg_match('/\/hu\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 13) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/hu/404/';
} else if (preg_match('/\/it\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 15) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/it/404/';
} else if (preg_match('/\/sa\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 16) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/sa/404/';
} else if (preg_match('/\/nl\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 18) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/nl/404/';
} else if (preg_match('/\/no\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 19) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/no/404/';
} else if (preg_match('/\/sg\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 20) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/sg/404/';
} else if (preg_match('/\/es\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 23) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/es/404/';
} else if (preg_match('/\/se\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 24) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/se/404/';
} else if (preg_match('/\/tr\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 26) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/tr/404/';
} else if (preg_match('/\/ae\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 27) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/ae/404/';
} else if (preg_match('/\/us\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 28) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/us/404/';
} else {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = '/uk/404/';
}
My Typoscript for languages (to keep it small just for german and dutch, other languages are similar):
config {
sys_language_uid = 0
language = en
locale_all = en_EN
}
[globalVar = GP:L = 12]
config {
sys_language_uid = 12
language = de
locale_all = de_DE
sys_language_overlay = hideNonTranslated
sys_language_mode = strict
}
lib.language.value = 12
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 12
plugin.tx_indexedsearch.settings.languageUid = 12
[global]
[globalVar = GP:L = 18]
config {
sys_language_uid = 18
language = nl
locale_all = nl_NL
sys_language_overlay = hideNonTranslated
sys_language_mode = strict
}
lib.language.value = 18
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 18
plugin.tx_indexedsearch.settings.languageUid = 18
[global]
Unfortunately I am not sure how to reproduce this. I found out that some links in dutch always are right, while others are not.
My guess is: The page got translated and called, but the title wasnt changed then, so that the default-title was taken and that it got cached. Then the title got changed and the new URL got cached too. This would fit with the fact, that the "wrong" URLs do not work while logged in in the backend, cause as far as I know while you are logged the system will not use some caches.
(While I wrote this question I really think now my guess is true, can someone confirm?)
Is there some way to priorice one URL over another? I would like to see the newer/the current title, URL will be taken.
Just delete it at this time is unfortunately not possible, as we send out some of the "wrong" URLs in a newsletter and it would be nice if we could keep the "wrong" URLs for a month, but use only the current URL for Menus/Links.
Any way to do this?

Related

Fedex SOAP Request Failing

I am looking for the reason why the below request is failing to retrieve information. This is copied from the Fedex developer website and it doesn't work. When my program hits the GetRates line it throws a could not connect to host exception. I tried adding the connection_timeout and setting the default_timeout in php and neither appear to work. I contacted the Fedex dev team and they are receiving my post successfully I am just not able to get any response besides the fault. Has anyone had experience with Fedex or know what might cause this to be failing?
I am posting my current code below. I am using PHP7 on an AS400 machine using Zendserver.
<?php
// Copyright 2009, FedEx Corporation. All rights reserved.
// Version 12.0.0
require_once('../library/fedex-common.php5');
$newline = "<br />";
//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "../wsdl/RateService_v24.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
ini_set('soap.wsdl_cache_ttl',0);
$client = new SoapClient($path_to_wsdl, array('trace' => 1, 'connection_timeout' => 30)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
$request['WebAuthenticationDetail'] = array(
'ParentCredential' => array(
'Key' => getProperty('parentkey'),
'Password' => getProperty('parentpassword')
),
'UserCredential' => array(
'Key' => getProperty('key'),
'Password' => getProperty('password')
)
);
$request['ClientDetail'] = array(
'AccountNumber' => getProperty('shipaccount'),
'MeterNumber' => getProperty('meter')
);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request using PHP ***');
$request['Version'] = array(
'ServiceId' => 'crs',
'Major' => '24',
'Intermediate' => '0',
'Minor' => '0'
);
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'INTERNATIONAL_PRIORITY'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['TotalInsuredValue']=array(
'Ammount'=>100,
'Currency'=>'USD'
);
$request['RequestedShipment']['Shipper'] = addShipper();
$request['RequestedShipment']['Recipient'] = addRecipient();
$request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1();
try {
if(setEndpoint('changeEndpoint')){
$newLocation = $client->__setLocation(setEndpoint('endpoint'));
}
$response = $client -> getRates($request);
if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR'){
$rateReply = $response -> RateReplyDetails;
echo '<table border="1">';
echo '<tr><td>Service Type</td><td>Amount</td><td>Delivery Date</td></tr><tr>';
$serviceType = '<td>'.$rateReply -> ServiceType . '</td>';
if($rateReply->RatedShipmentDetails && is_array($rateReply->RatedShipmentDetails)){
$amount = '<td>$' . number_format($rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount,2,".",",") . '</td>';
}elseif($rateReply->RatedShipmentDetails && ! is_array($rateReply->RatedShipmentDetails)){
$amount = '<td>$' . number_format($rateReply->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount,2,".",",") . '</td>';
}
if(array_key_exists('DeliveryTimestamp',$rateReply)){
$deliveryDate= '<td>' . $rateReply->DeliveryTimestamp . '</td>';
}else if(array_key_exists('TransitTime',$rateReply)){
$deliveryDate= '<td>' . $rateReply->TransitTime . '</td>';
}else {
$deliveryDate='<td> </td>';
}
echo $serviceType . $amount. $deliveryDate;
echo '</tr>';
echo '</table>';
printSuccess($client, $response);
}else{
printError($client, $response);
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
function addShipper(){
$shipper = array(
'Contact' => array(
'PersonName' => 'Sender Name',
'CompanyName' => 'Sender Company Name',
'PhoneNumber' => '9012638716'
),
'Address' => array(
'StreetLines' => array('Address Line 1'),
'City' => 'Collierville',
'StateOrProvinceCode' => 'TN',
'PostalCode' => '38017',
'CountryCode' => 'US'
)
);
return $shipper;
}
function addRecipient(){
$recipient = array(
'Contact' => array(
'PersonName' => 'Recipient Name',
'CompanyName' => 'Company Name',
'PhoneNumber' => '9012637906'
),
'Address' => array(
'StreetLines' => array('Address Line 1'),
'City' => 'Richmond',
'StateOrProvinceCode' => 'BC',
'PostalCode' => 'V7C4V4',
'CountryCode' => 'CA',
'Residential' => false
)
);
return $recipient;
}
function addShippingChargesPayment(){
$shippingChargesPayment = array(
'PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
'Payor' => array(
'ResponsibleParty' => array(
'AccountNumber' => getProperty('billaccount'),
'CountryCode' => 'US'
)
)
);
return $shippingChargesPayment;
}
function addLabelSpecification(){
$labelSpecification = array(
'LabelFormatType' => 'COMMON2D', // valid values COMMON2D, LABEL_DATA_ONLY
'ImageType' => 'PDF', // valid values DPL, EPL2, PDF, ZPLII and PNG
'LabelStockType' => 'PAPER_7X4.75'
);
return $labelSpecification;
}
function addSpecialServices(){
$specialServices = array(
'SpecialServiceTypes' => array('COD'),
'CodDetail' => array(
'CodCollectionAmount' => array(
'Currency' => 'USD',
'Amount' => 150
),
'CollectionType' => 'ANY' // ANY, GUARANTEED_FUNDS
)
);
return $specialServices;
}
function addPackageLineItem1(){
$packageLineItem = array(
'SequenceNumber'=>1,
'GroupPackageCount'=>1,
'Weight' => array(
'Value' => 50.0,
'Units' => 'LB'
),
'Dimensions' => array(
'Length' => 108,
'Width' => 5,
'Height' => 5,
'Units' => 'IN'
)
);
return $packageLineItem;
}
?>

RealUrl - language path segment

My realurl.conf contains the following:
'2' => array (
'GETvar' => 'L',
'valueMap' => array (
'en' => '1',
'nl' => '2',
'be-nl' => '3
'be-fr' => '4'
),
'noMatch' => 'bypass',
),
and:
array(
'GETvar' => 'L',
'value' => '3',
'urlPrepend' => 'http://www.example.be',
'useConfiguration' => 'www.example.be',
),
array(
'GETvar' => 'L',
'value' => '4',
'urlPrepend' => 'http://www.example.be/fr',
'useConfiguration' => 'www.example.be/fr',
),
and:
[globalVar= GP:L=4]
//french (Belgium) = 4
config{
sys_language_uid = 4
language = fr
htmlTag_setParams = lang="fr"
locale_all = fr_FR.UTF-8
sys_language_mode = content_fallback;4,8
}
page.bodyTagCObject.30.value = fr
[global]
In T3 backend the url "www.example.be/fr" is configured properly and content is there for the specific languages.
When I go to www.example.be/fr, I get the L-parameter 3 and the content for the language id 3. Could anyone help me out on this?

typo3 language chooser issues after choosing new language

Hi in my typo3 8 website I've added a language chooser. Choosing a language works fine, content switches from german to english it works fine content switches properly.
Issue is when I click a link in english version it always falls back to the german link because /en/ is missing in the Link URL
URL in the Browser looks good the en is there, but in the navigation the URL to an page does not conatin en
I use Typo3 8 and realURL
Typoscript:
config {
sys_language_uid = 0
language = de
locale_all = de_DE.UTF-8
htmlTag_langKey = de
}
config.tx_realurl_enable = 1
[globalVar = GP:L = 1]
config {
sys_language_uid = 1
language = en
locale_all = en_US.UTF-8
htmlTag_langKey = en
}
[global]
temp.langMenu = HMENU
temp.langMenu.special = language
temp.langMenu.special.value = 0,1
temp.langMenu.1 = GMENU
temp.langMenu.1.NO {
XY = [5.w]+4, [5.h]+4
transparentColor = #17353e
backColor = #17353e
5 = IMAGE
5.file = fileadmin/design/images/flag_de.gif || fileadmin/design/images/flag_en.gif
}
temp.langMenu.1.ACT < lib.langMenu.1.NO
temp.langMenu.1.USERDEF1 < lib.langMenu.1.NO
temp.langMenu.1.USERDEF1 = 1
temp.langMenu.1.USERDEF1.5.file = fileadmin/design/images/flag_de.gif || fileadmin/design/images/flag_en.gif
temp.langMenu.1.USERDEF1.noLink = 1
RealURL Config:
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
'_DEFAULT' =>
array (
'init' =>
array (
'appendMissingSlash' => 'ifNotFile,redirect',
'emptyUrlReturnValue' => '/',
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 7,
'rootpage_id' => 1,
'firstHitPathCache' => 1,
),
'fileName' =>
array (
'defaultToHTMLsuffixOnPrev' => 0,
'acceptHTMLsuffix' => 1,
'index' =>
array (
'print' =>
array (
'keyValues' =>
array (
'type' => 98,
),
),
),
),
'preVars' =>
array (
0 =>
array (
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
),
'valueDefault' => 'de',
# 'noMatch' => 'bypass',
),
),
),
);
What is my fail in this case?
Thanks in Advance.
You need to add config.linkVars = L(0-1) to your Typoscript config. This will tell the TYPO3 system to pass this link parameter to each generated url.
Please note that this configuration will only apply to internal links generated by the TYPO3 system itself: For example in menues or when you link another page in the RTE. Absolutely placed links will not be affected by this configuration.
The docs: https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#linkvars

TYPO3: RealURL Language Switch for Extbase Extension

I have set up a single-domain website with different languages and configured RealURL.
On one page, there is a FE plugin with list and show actions. The links from the list to the show action are rendered correctly, for example:
en/press.html -> en/press/release1.html
en/press.html -> en/press/release2.html
Clicking on one of the links surfaces the detail page - so far, so good. Everything works as expected.
However, the language switch returns the following links (on the detail page):
en/press.html
de/presse.html
The links, of course, should read as follows:
en/press/release1.html
de/presse/aussendung1.html
Also, the breadcrumb menu does not show the detail page; it reads Home > Press, regardless of whether I'm on the list or show action.
Language Nav
temp.langNav = COA
temp.langNav {
10 = HMENU
10 {
special = language
special.value = 0,1,2,3,4,5,6,7,8
special.normalWhenNoLanguage = 0
wrap = <ul class="lang-sel__list">|</ul>
1 = TMENU
1 {
noBlur = 1
NO = 1
NO {
allWrap = <li class="lang-sel__item">|</li>
ATagParams = class="lang-sel__link"
stdWrap.setCurrent = English || Deutsch || Русский || Česky || Polski || Français || Română || Hrvatski || Slovenčina
stdWrap.current = 1
}
USERDEF1 = 1
USERDEF1 {
doNotLinkIt = 1
stdWrap.cObject = TEXT
stdWrap.cObject.value =
}
}
}
}
temp.selectedLang = TEXT
temp.selectedLang.value < config.language
Breadcrumb Nav
temp.breadcrumbNav=COA
temp.breadcrumbNav {
10 = HMENU
10 {
special = rootline
special.range = 0|-1
includeNotInMenu = 1
wrap = |
1 = TMENU
1.noBlur = 1
1.CUR = 1
1.wrap = |
1.NO {
stdWrap.field = title
ATagParams = class="main-header__breadcrumb-link"
ATagTitle.field = nav_title // title
linkWrap = <li class="main-header__breadcrumb-item">|</li>
}
1.CUR {
stdWrap.field = title
linkWrap = <li class="main-header__breadcrumb-item">|</li>
doNotLinkIt = 1
}
}
}
RealURL Config
$TYPO3_CONF_VARS['FE']['addRootLineFields'].= ',tx_realurl_pathsegment';
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
'init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'postVarSet_failureMode' => '',
),
'redirects' => array(),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'en' => 0,
'de' => 1,
'ru' => 2,
'cz' => 3,
'pl' => 4,
'fr' => 5,
'ro' => 6,
'hr' => 7,
'sk' => 8
),
'valueDefault' => 'en',
),
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 7,
'rootpage_id' => 1,
'firstHitPathCache' => 1,
),
'fixedPostVars' => array(
'_DEFAULT' => array(
array(
'GETvar' => 'press',
'lookUpTable' => array(
'table' => 'tx_myext_domain_model_press',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
),
'languageGetVar' => 'L',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
)
)
),
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => 1
),
),
);
You need to tell TYPO3 to keep the parameters.
This is done by configuring addQueryString in the HMENU ConentObject.
Your example would be extended by:
temp.breadcrumbNav=COA
temp.breadcrumbNav {
10 = HMENU
10 {
1 {
NO {
addQueryString.exclude = L,cHash
}
}
}
}
For further information check the documentation:
docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Hmenu/Index.html and docs.typo3.org/typo3cms/TyposcriptReference/Functions/Typolink/Index.html
And the solution above can be found on forge: https://forge.typo3.org/issues/16466#note-3

tt_news: no news_id given when changing language in single view

I'm using TYP 4.5.5, RealURL 1.11.2 and tt_news 3.0.1. I want that the user can switch the language and the corresponding news is shown in the users language. All should work with RealURL.
When switching language the news id is not submitted. So I have to explicitely submit the id. I found some threads which showed me how it could work, but I didn't get it managed. Here is my TS:
lib.tslangmenu = COA
lib.tslangmenu {
10 = HTML
10.value(
<img src="fileadmin/templates/images/languages_en.png" width="48" height="121" alt="Languages" />
<div id="LanguageContents">
)
20 = HMENU
20.special = language
20.wrap = <div id="AvailableLanguages">|</div>
20.special.value = 0,1
20.1 = GMENU
20.1.NO {
XY = 24,16
5 = IMAGE
5.file = fileadmin/templates/images/deutsch.png || fileadmin/templates/images/englisch.png
additionalParams.cObject = COA
additionalParams.cObject {
5 = TEXT
5.wrap = &L=1
10 = TEXT
10.data = GPvar : tx_ttnews | backPid
10.wrap = &tx_ttnews[backPid]=|
10.required = 1
20 = TEXT
20.data = GPvar : tx_ttnews | tt_news
20.wrap = &tx_tt_news[tt_news]=|
20.required = 1
30 = TEXT
30.data = GPvar : cHash
30.wrap = &cHash=|
30.required = 1
}
}
30 = HTML
30.value(
<img class="languagebutton" src="fileadmin/templates/images/languages_en.png" width="48" height="121" alt="Languages" />
</div>
)
According to the information I found I should use additionalParams and set the parameter with GPVar. But I always get the no news_id given message.
Here is my RealURL Config:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array (
'_DEFAULT' => array (
'init' => array (
'enableCHashCache' => '1',
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => '1',
'enableUrlEncodeCache' => '1',
),
'redirects' => array (
),
'preVars' => array (
'0' => array (
'GETvar' => 'no_cache',
'valueMap' => array (
'nc' => '1',
),
'noMatch' => 'bypass'
),
'1' => array (
'GETvar' => 'L',
'valueMap' => array (
'de' => '0',
'en' => '1',
),
'valueDefault' => 'de',
'noMatch' => 'bypass',
),
'2' => array (
'GETvar' => 'lang',
'valueMap' => array (
'de' => 'de',
'en' => 'en',
),
'noMatch' => 'bypass',
),
),
'pagePath' => array (
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '7',
'rootpage_id' => '1',
),
'fixedPostVars' => array (
),
'postVarSets' => array (
'_DEFAULT' => array (
'archive' => array (
'0' => array (
'GETvar' => 'tx_ttnews[year]',
),
'1' => array (
'GETvar' => 'tx_ttnews[month]',
'valueMap' => array (
'january' => '01',
'february' => '02',
'march' => '03',
'april' => '04',
'may' => '05',
'june' => '06',
'july' => '07',
'august' => '08',
'september' => '09',
'october' => '10',
'november' => '11',
'december' => '12',
),
),
),
'browse' => array (
'0' => array (
'GETvar' => 'tx_ttnews[pointer]',
),
),
'select_category' => array (
'0' => array (
'GETvar' => 'tx_ttnews[cat]',
),
),
'article' => array(
array(
'GETvar' => 'tx_ttnews[pointer]',
'valueMap' => array(),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_ttnews[tt_news]',
'lookUpTable' => array(
'table' => 'tt_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l18n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
array (
'GETvar' => 'tx_ttnews[swords]',
),
),
),
),
Solution:
Seems that adding addQueryString does the job. Here is my final language switcher:
lib.tslangmenu = COA
lib.tslangmenu {
10 = HTML
10.value(
<img src="fileadmin/templates/images/languages.png" width="48" height="121" alt="Sprachen" />
<div id="LanguageContents">
)
20 = HMENU
20.special = language
20.wrap = <div id="AvailableLanguages">|</div>
20.special.value = 0,1
20.addQueryString = 1
20.1 = GMENU
20.1.NO {
XY = 24,16
5 = IMAGE
5.file = fileadmin/templates/images/deutsch.png || fileadmin/templates/images/englisch.png || fileadmin/templates/images/kroatisch.png
}
20.1.ACT < 20.1.NO
20.1.ACT = 1
20.1.ACT.wrap =<span class="langhide">|</span>
20.1.ACT {
XY = 24,16
5 = IMAGE
5.file = fileadmin/templates/images/deutsch.png || fileadmin/templates/images/englisch.png || fileadmin/templates/images/kroatisch.png
}
20.1.CUR < 20.1.ACT
20.1.CUR = 1
20.1.CUR{
XY = 24,16
5 = IMAGE
5.file = fileadmin/templates/images/deutsch.png || fileadmin/templates/images/englisch.png || fileadmin/templates/images/kroatisch.png
}
30 = HTML
30.value(
<img class="languagebutton" src="fileadmin/templates/images/languages.png" width="48" height="121" alt="Sprachen" />
</div>
)
}
Take a look at the following properties for your menu:
protectLvar
addQueryString <--- keeps the params to the string when switching languages.
TSREF is your friend:
http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.6.0/view/1/7/#id2635691
Your TypoScript has some errors:
20.wrap = &tx_tt_news[tt_news]=|
Remove tthe underscore:
20.wrap = &tx_ttnews[tt_news]=|
And do not set cHash by hand! 30.wrap = &cHash=| It will prevent your page from being cached, because the cHash will be wrong!