[TYPO3-english] no news_id given tt_news single view
PIT Solutions
typo3 at pitsolutions.com
Wed Nov 27 06:17:02 CET 2013
Hi,
Thanks for the reply. Ok here I share my code;
In typoscript part;
# Lang Menu
includeLibs.user_test = fileadmin/user_test.php
page.20 = USER
page.20 {
userFunc = user_test->user_myFunc
value = 0=>fileadmin/templates/images/flag1.png,1=>fileadmin/templates/images/flag2.png,2=>fileadmin/templates/images/flag3.png
}
Here I've passed 3 languge sys_language_uid values and 3 flag images to my function.
In my PHP file ie,user_test.php,
I've taken the language value from the URL and process the HTML based on that. See the code here;
class user_test{
public function user_myFunc($content, $conf){
$this->cObj = t3lib_div::makeInstance('tslib_cObj');
$arrayValues = explode(",", $conf["value"]);
$urlLanguage = t3lib_div::_GP('L');
$langVal = ( empty( $urlLanguage ) ) ? 0 : $urlLanguage;
$menu .= "<ul>";
foreach ( $arrayValues as $key=>$value ){
$stringValues = explode("=>", $value);
if( $stringValues[0] == 0 ){
$text = 'Français';
$enc = mb_detect_encoding('Français', "UTF-8,ISO-8859-1");
$langLabel = iconv($enc, "UTF-8", $text);
}else{
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('title','sys_language','uid='.$stringValues[0]);
$langLabel = $rows[0]['title'];
}
if( $langVal == $stringValues[0] ){
$menu1 .= '<li><img src="'.$stringValues[1].'"><a>'.$langLabel.'</a><span id="img1" class="right"></span>';
}else{
$conf = array(
'parameter' => $GLOBALS['TSFE']->id,
'additionalParams' => '&L='.$stringValues[0],
'returnLast' => 'url',
);
$url = $this->cObj->typoLink('', $conf);
$menu2 .= '<li><img src="'.$stringValues[1].'"><a href="'.$url.'">'.$langLabel.'</a></li>';
}
}
$menu3 .= '<ul id="lichild" class="child">'.$menu2.'</ul>';
$menu .= $menu1.$menu3."</li></ul>";
return $menu;
}
}
So how can we solve the issue in tt_news items detail view?
Please help,
Arun
________________________________
From: Xavier Perseguers <xavier at typo3.org>
To: typo3-english at lists.typo3.org
Sent: Tuesday, November 26, 2013 6:11 PM
Subject: Re: [TYPO3-english] no news_id given tt_news single view
Hi,
> Thanks for the information. Can you please give me an example of how can I add it in to tt_news in my function?
>
> In my function, just took the language value from the URL and process the HTML based on that. So how can I fix this problem
> for tt_news in my function.
Maybe it could be helpful to show us what you wrote in your function
first, so that I or someone else can give you a hint on what to change.
--
Xavier Perseguers
Release Manager TYPO3 4.6
TYPO3 .... inspiring people to share!
Get involved: http://typo3.org
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
More information about the TYPO3-english
mailing list