[TYPO3-timtab] Quick and Dirty fix for multilanguage and PREV/NEXT link and categories
Andreas Hupfau
andreas at hupfau.com
Thu Jul 26 11:58:29 CEST 2007
Hello Group,
since I needed it for our own site I've made a quick hack to support
multilanguage sites (more or less) correctly.
I thought it could also be interesting for other so I'm posting it here:
1. PREV/NEXT links on Single Display fix to show only current language
links:
change the following two functions in class.tx_timtab_fe.php:
------
/**
* gets previous post if available
*
* @return array
*/
function getPrevPost() {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'uid, title, datetime',
'tt_news',
'pid IN ('.$this->pObj->conf['pid_list'].') AND datetime <
'.$this->conf['data']['datetime'].$this->cObj->enableFields('tt_news').
' AND sys_language_uid='.$GLOBALS['TSFE']->sys_language_uid,
'',
'datetime DESC'
);
return $res[0];
}
/**
* gets previous post if available
*
* @return array
*/
function getNextPost() {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'uid, title, datetime',
'tt_news',
'pid IN ('.$this->pObj->conf['pid_list'].') AND datetime >
'.$this->conf['data']['datetime'].$this->cObj->enableFields('tt_news').
' AND sys_language_uid='.$GLOBALS['TSFE']->sys_language_uid,
'',
'datetime ASC'
);
return $res[0];
}
-----
this just adds the current sys_language_uid to the WHERE clause of the SQL.
2. Translation of categories in timtab_catmenu:
add/change the following lines in class.tx_timtab_catmenu.php:
-----
function getCategoryLink($category, $count, $lastPost) {
...
$title = '';
$actLang = $GLOBALS['TSFE']->sys_language_uid;
if ($actLang > 0)
{
$langTitles = split('\|',$category['title_lang_ol']);
if (count($langTitles)>$actLang-2)
$title = $langTitles[$actLang-1];
}
if ($title == '')
$title = $category['title'];
$link = $this->cObj->typoLink($title, $conf);
-----
that's it :)
greetings
gipsy
More information about the TYPO3-project-timtab
mailing list