[TYPO3-timtab] Quick and Dirty fix for multilanguage and PREV/NEXT link and categories
Andreas Hupfau
andreas at hupfau.com
Fri Jul 27 14:33:48 CEST 2007
Andreas Hupfau wrote:
> Hello Group,
>
> 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 :)
>
sorry, forgot 2 things:
* of course you have to add the "title_lang_ol" filed to the SELECT
query in "function getCategories()":
-----
$categories = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'uid, title, description, parent_category, title_lang_ol',
-----
* and to also have the linktip localized you have to change the
"function getCategoryLink":
------
function getCategoryLink($category, $count, $lastPost) {
$urlParams = array(
'tx_ttnews[cat]' => $category['uid'],
);
$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'];
$aTagParams = '';
if ($this->conf['displayCatMenu.']['useDescForTitle'] == 0 ||
empty($category['description'])) {
$aTagParams .= '
title="'.sprintf($this->pi_getLL('view_category_posts'), $title).'"';
} else {
$aTagParams .= ' title="'.$category['description'].'"';
}
$conf = array(
'useCacheHash' => $this->conf['allowCaching'],
'no_cache' => !$this->conf['allowCaching'],
'parameter' => $this->conf['displayCatMenu.']['targetPid'],
'additionalParams' =>
$this->conf['parent.']['addParams'].t3lib_div::implodeArrayForUrl('',$urlParams,'',1).$this->pi_moreParams,
'ATagParams' => $aTagParams
);
$link = $this->cObj->typoLink($title, $conf);
if($this->conf['displayCatMenu.']['showCount']) {
$count = $count ? $count : 0;
$link .= ' ('.$count.')';
}
if($this->conf['displayCatMenu.']['showLatestDate']) {
$link .= '
'.strftime($this->conf['displayCatMenu.']['catLatestDate.']['strftime'],
$lastPost);
}
return $link;
}
-----
greetings
gipsy
More information about the TYPO3-project-timtab
mailing list