Skip to content

Instantly share code, notes, and snippets.

@jochla
Last active December 15, 2015 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jochla/a1c0e98abb6cb572130a to your computer and use it in GitHub Desktop.
Save jochla/a1c0e98abb6cb572130a to your computer and use it in GitHub Desktop.
Funktionierende realURL Konfiguration für drei Sprachen mit den Extensions "YAG" und "news". Basis: http://docs.typo3.org/typo3cms/extensions/news/latest/Main/Administration/Realurl/Index.html (advanced Example)
<?php
$TYPO3_CONF_VARS['FE']['addRootLineFields'].= ',tx_realurl_pathsegment';
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'encodeSpURL_postProc' => array(
'yag' => 'EXT:yag/Classes/Hooks/RealUrlHook.php:user_Tx_Yag_Hooks_RealUrl->encodeSpURL_postProc',
),
'decodeSpURL_preProc' => array(
'yag' => 'EXT:yag/Classes/Hooks/RealUrlHook.php:user_Tx_Yag_Hooks_RealUrl->decodeSpURL_preProc',
),
'_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,
# If set, page shortcuts are not resolved to their destination page.
#'dontResolveShortcuts' => '1',
),
'init' => array(
'enableCHashCache' => TRUE,
'enableCHashCache' => 1,
'respectSimulateStaticURLs' => 0,
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'appendMissingSlash' => 'ifNotFile',
# Default (blank value) is a 404 page not found from TYPO3s frontend API.
# "ignore": A silent accept of the remaining parts.
# "redirect_goodUpperDir": Will compose a URL from the parts successfully mapped and redirect to that.
'postVarSet_failureMode' => '',
),
'preVars' => array(
array (
'GETvar' => 'no_cache',
'valueMap' => array (
'nc' => '1',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
'nl' => '2',
),
'noMatch' => 'bypass',
),
),
'fileName' => array (
//
// if you don't want .html-URLs set the following to "false" (e.g. 'defaultToHTMLsuffixOnPrev' => false,)
// then you get http://www.yourdomain.com/imprint/ instead of http://www.yourdomain.com/imprint.html
//
'defaultToHTMLsuffixOnPrev' => true,
'index' => array (
'sitemap.xml' => array (
'keyValues' => array (
'type' => '776',
),
),
'rss-newsfeed.xml' => array (
'keyValues' => array (
'type' => '9818',
),
),
'rss-newsfeed.html' => array (
'keyValues' => array (
'type' => '9818',
),
),
),
),
'fixedPostVars' => array(
'newsDetailConfiguration' => array(
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,
),
),
),
'newsCategoryConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_category',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
),
),
),
),
'newsTagConfiguration' => 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' => '-'
),
),
),
),
# Set page IDs
'81' => 'newsDetailConfiguration', // Angebote und Aktionen
'148' => 'newsDetailConfiguration', // News und Toernberichte
#'71' => 'newsTagConfiguration',
#'72' => 'newsCategoryConfiguration',
),
'postVarSets' => array(
'_DEFAULT' => array(
'controller' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass',
),
),
'dateFilter' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
),
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
),
),
),
),
)
);
# Kontrollstruktur für mehrsprachigen 404- Fehlerseiten
# 0- Deutsch
# 1 - Englisch
# 2 - Niederländisch
if (preg_match('/\/de\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 0) {
$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = '/de/404.html';
} else if (preg_match('/\/en\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 1) {
$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = '/en/404.html';
} else if (preg_match('/\/nl\//', $_SERVER['REQUEST_URI']) || $_GET['L'] == 2) {
$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = '/nl/404.html';
} else {
$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = '/en/404.html';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment