[TYPO3-english] Re: Detecting if current output is content_fallback fails
J. Peter M. Schuler
j.peter.m.schuler at icb.uni-due.de
Fri Mar 29 23:43:10 CET 2013
> Problem: The Condition
> [globalVar = TSFE:sys_language_content>0]
> won't work.
90% of PHP-Array TSFE isn't generated at the moment the typoscript is parsed, so it doesn't work. The only option to achieve this is to use a userfunc.
A quick-and-dirty userfunc (which doesn't take into account workspaces/versioning) could be:
function user_isTranslationMissing() {
$pid = (int)$_GET['id'];
$lang = (int)$_GET['L'];
if (($pid < 1) || ($lang < 1)) return(false);
$query = "SELECT P.uid,P.title AS title_orig,L.title,L.sys_language_uid FROM pages AS P INNER JOIN pages_language_overlay AS L ON (L.pid = P.uid) WHERE L.hidden=0 AND L.deleted=0 AND P.hidden = 0 AND P.deleted= 0 AND L.sys_language_uid = ".$lang." AND L.pid = ".$pid;
if (!$result = $GLOBALS['TYPO3_DB']->sql_query($query)) {
return(false);
}
while ($rowtemp = mysql_fetch_assoc($result)) {
return(false);
}
return(true);
}
Just added this for reference if this thread comes up in search results - improvements to this function are welcome.
More information about the TYPO3-english
mailing list