Related
I'm using TYPO3 7.6 with a multidomain and multilanguage Website, you see the links below. I've one page tree and rootpage_id for all three languages!
First language is german (L=0, https://www.renosan.de/)
Second language is english (L=1, https://www.renosan.net/)
Third language is polish (L=2, https://www.renosan.pl/)
For every language I'm using an own top-level domain (de,net,pl). I've also insert the domain records at my root page (TYPO3-Backend List -> Rootpage -> Domain records)
If I'm clicking at the preview button (s. image), the preview opens in a new window with:
English: https://www.renosan.de/index.php?id=1&L=1
Polish: https://www.renosan.de/index.php?id=1&L=2
... but the content is still in the default language (german)! I need to change the TLD to change the Website language manually. It's not useful for my editors, because they aren't seeing the preview with one click.
Can someone explain the behaviour from TYPO3?
I also tried to login into Backend from .net or .pl, nothing happens. It's always the default preview. No special .htaccess entries ...
My TypoScript Setup
### default german
config {
linkVars = L(0-2)
uniqueLinkVars = 1
sys_language_mode = content_fallback
sys_language_overlay = hideNonTranslated
sys_language_uid = 0
language = de
locale_all = de_DE.UTF8
htmlTag_langKey = de
}
### english L=1
[globalString = IENV:HTTP_HOST = *renosan.net]
config {
baseURL = https://www.renosan.net/
sys_language_uid = 1
language = en
locale_all = en_GB.UTF8
htmlTag_langKey = en
}
[GLOBAL]
### polski L=2
[globalString = IENV:HTTP_HOST = *renosan.pl]
config {
baseURL = https://www.renosan.pl/
sys_language_uid = 2
language = pl
locale_all = pl_PL.UTF8
htmlTag_langKey = pl
}
[GLOBAL]
I have locate the problem with my individual realURL-conf. If I try it with the 'autoconf' from Ext:realURLthe preview from Backend works!
Here's my personal realURL-Configuration file:
<?php
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '3',
'rootpage_id' => 1,
'firstHitPathCache'=> 1
),
'init' => array(
'enableCHashCache' => 1,
'respectSimulateStaticURLs' => 0,
'postVarSet_failureMode' => '',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1
),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
//'de' => '0',
'en' => '1',
'pl' => '2'
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'nc' => 1,
),
'noMatch' => 'bypass',
),
),
'fixedPostVars' => array(
'newsDetailConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass',
),
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,
),
),
),
'42' => 'newsDetailConfiguration',
'43' => 'newsDetailConfiguration',
),
'postVarSets' => array(
'_DEFAULT' => array(
'controller' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass',
),
),
'tags' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
'lookUpTable' => array (
'table' => 'tx_news_domain_model_tag',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => 'AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array (
'strtolower' => 1,
'spaceCharacter' => '-',
),
),
),
),
'seite' => array(
array(
'GETvar' => 'tx_news_pi1[#widget_0][currentPage]',
),
),
// news archive parameters
'archiv' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
),
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][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',
),
),
),
),
),
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DOMAINS'] = array(
'encode' => array(
array(
'GETvar' => 'L',
'value' => '0',
'useConfiguration' => 'renosan.de',
'urlPrepend' => 'https://www.renosan.de'
),
array(
'GETvar' => 'L',
'value' => '1',
'useConfiguration' => 'renosan.de',
'urlPrepend' => 'https://www.renosan.net'
),
[
'GETvar' => 'L',
'value' => '2',
'useConfiguration' => 'renosan.de',
'urlPrepend' => 'https://www.renosan.pl'
],
),
'decode' => array(
'renosan.de' => array(
'GETvars' => array(
'L' => '0',
),
'useConfiguration' => 'renosan.de'
),
'renosan.net' => array(
'GETvars' => array(
'L' => '1',
),
'useConfiguration' => 'renosan.de'
),
'renosan.pl' => array(
'GETvars' => array(
'L' => '2',
),
'useConfiguration' => 'renosan.de'
),
)
);
?>
Thanks for your help .. I have still no solution for this TYPO3-Problem?! Is it a TYPO3-Bug? Is there a problem with my realURL-Configuration-File?
I think your conditions are wrong and TYPO3 gets so confused that the conditions are ignored completely.
it is not
[global string = ENV: HTTP_HOST = ...
but:
[globalString = ENV:HTTP_HOST = ...
On the other hand I assume your TYPO3 will also gets confused about domains and additional language parameter. For preview you need to be logged in into the BE (cookies are domain dependend). So a preview in another language is possible only with language parameter. Your configuration mixes domains and language parameter: if you start with www.renosan.de?L=1 your baseurl is changed.
My recommandation: Split the handling depending on domain and L-Param.
If you use RealURL: Look at this blog post. Here you can see how to config realURL to watch at the Domains to seperate languages.
After that, you dont need conditions about the domains. You can use the simple [globalVar = GP:L = x] conditions.
We have multiple pagetrees for each region (e.g. Germany, Suisse). The pages themselves are translated to several languages (e.g. de, en) using the L-Parameter.
Now Realurl should match from 2 url segments to the approriate page tree and language. I know how this can be done with separate domains for each region using the _Domains feature. But in this case the domain stays always the same for all regions. Can this be achieved with Realurl and how?
http://example.com/de/de => should map to pagetree with rootpage_id 1 and language de (L=0)
http://example.com/de/en => should map to pagetree with rootpage_id 1 and language en (L=1)
http://example.com/ch/de => should map to pagetree with rootpage_id 2 and language de (L=0)
http://example.com/ch/en => should map to pagetree with rootpage_id 2 and language en (L=1)
real_url.conf
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array(
'init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile,redirect',
'adminJumpToBackend' => 1,
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'emptyUrlReturnValue' => '/'
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '3',
'rootpage_id' => 1,
'firstHitPathCache'=>1
),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
),
'valueDefault' => 'de',
),
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'no_cache' => 1,
),
'noMatch' => 'bypass',
),
),
);
Now Realurl should match from 2 url segments to the approriate page tree and language.
RealURL cannot do that. Root page id is determined before segments are processed. It is defined by the domain record or your RealURL configuration.
The realurl config with tx_news works fine for me, but I have one problem. I dont need the detail-name in the address.
www.domain.org/news-list/news-detail/test-news-name-here/
and now i dont need the "news-detail".
Here the PHP code realurl.php
<?php
$TYPO3_CONF_VARS['FE']['addRootLineFields'].= ',tx_realurl_pathsegment';
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '3',
'rootpage_id' => 1,
'firstHitPathCache'=>1
),
'init' => array(
'enableCHashCache' => TRUE,
'enableCHashCache' => 1,
'respectSimulateStaticURLs' => 0,
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1
),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
//'de' => '0',
//'en' => '1',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'nc' => 1,
),
'noMatch' => 'bypass',
),
),
'fileName' => array(
'index' => array(
'sitemap.xml' => array(
'keyValues' => array(
'type' => 1234,
),
),
),
),
'fixedPostVars' => array(
'newsDetailConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass',
),
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,
),
),
),
'6' => 'newsDetailConfiguration',
// For additional detail pages, add their uid as well
//'13' => 'newsDetailConfiguration',
//'22' => 'newsDetailConfiguration',
//'4' => 'newsTagConfiguration',
//'4' => 'newsCategoryConfiguration',
),
'postVarSets' => array(
'_DEFAULT' => array(
'controller' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass',
),
),
'stadt' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
'lookUpTable' => array(
'table' => 'sys_category',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
),
),
),
'tags' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
'lookUpTable' => array (
'table' => 'tx_news_domain_model_tag',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => 'AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array (
'strtolower' => 1,
'spaceCharacter' => '-',
),
),
),
),
'seite' => array(
array(
'GETvar' => 'tx_news_pi1[#widget_0][currentPage]',
),
),
// news archive parameters
'archiv' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
),
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][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',
),
),
),
),
),
// configure filenames for different pagetypes
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => 0,
),
);
?>
I need that typoscript?
plugin.tx_news {
settings {
link {
skipControllerAndAction = 1
}
}
}
In the Detail-Page I check the realurl:
tx_realurl_exclude = 1
You can use detail & list plugin on the same page. Check this url: https://forge.typo3.org/issues/50489
lib.news = USER
lib.news {
userFunc = tx_extbase_core_bootstrap->run
pluginName = Pi1
extensionName = News
controller = News
settings =< plugin.tx_news.settings
persistence =< plugin.tx_news.persistence
view =< plugin.tx_news.view
}
lib.news_list< lib.news
lib.news_list {
action = list
switchableControllerActions.News.1 = list
}
lib.news_detail < lib.news
lib.news_detail {
action = detail
switchableControllerActions.News.1 = detail
}
[globalVar = GP:tx_news_pi1|news > 0]
lib.field_news_single < lib.news_detail
[else]
lib.field_news_list < lib.news_list
[end]
Answer: it is not possible to exclude the current (=last) page from speaking URL.
If you are interested in technical details, you can read more in the RealURL's notes for integrators.
Just an additional followup with another solution:
Use a TypoScript condition to render dynamically the detail plugin at the list page.
[globalVar = GP:tx_news_pi1|news > 0]
page.10 >
page.10 < lib.news
[global]
Of course you can do a lot more fancy stuff if you need to render e.g. other content elements as well!
[globalVar = GP:tx_news_pi1|news > 0]
page.10 >
page.10 = CONTENT
page.10 {
table = tt_content
pidInList = <page ID of your detail page>
orderBy = sorting
}
[global]
This will render you all content elements of the detail page on the list page.
If you want to have list and single view on separate pages then extension singleview at https://github.com/sourcebroker/singleview does exactly what you want.
This extension uses TYPO3 build in feature "Show content from pid" which you can find in page properties. In this extension value for "Show content from pid" field is set dynamically based on $_GET parameter. When TYPO3 renders page with list view then ext:singleview checks if $_GET parameter has single view request. If this is true then it sets "content_from_pid" field with value of single view page uid. This way single view page with its content and layout is shown on list view page.
For TYPO3 7.6 use ext:singlenews version 1.3.
I´m running a Typo3 4.5.12 and the realurl extension verson 1.11.1.
My site has 3 languages de, en, ch and the default language is de, german.
If I clear the cache of realurl and call first www.example.com/site all is ok.
But if I call after clearCache first for example a url with language-param like www.example.com/en/site and after that www.example.com/site, all links get the ../en/.. in the href-tag like www.example.com/en/site2.
It´s the same when I call first after clearCache a site with ../ch/.. or ../de/..
Why he don´t pick the default-language when I call www.example.com/site in links?
My config of realurl:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'respectSimulateStaticURLs' => 0,
),
'redirects_regex' => array (
),
'preVars' => array(
array(
'GETvar' => 'no_cache',
'valueMap' => array('no_cache' => 1),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
'cn' => '2',
),
'defaultValue' => 'de',
'noMatch' => 'bypass',
),
),
...
My page config:
simulateStaticDocuments = 0
tx_realurl_enable = 1
prefixLocalAnchors = all
linkVars = mobile(off),L
uniqueLinkVars = 1
sys_language_uid = 0
language = de
locale_all = de_DE.UTF-8
sys_language_mode = content_fallback
sys_language_overlay = 1
[...]
'defaultValue' => 'de',
'noMatch' => 'bypass',
[...]
Are somewhat contra dictionary.
Take the noMatch out, this will create url's like:
/site1 (german)
/en/site1 (english)
/cn/site1 (chinese)
Otherwise go for
'noMatch' => 'de' //(without `'defaultValue' => 'de'`)
to get
/de/site1 (german)
/en/site1 (english)
/cn/site1 (chinese)
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!